Posted on: 01/13/04 10:08pm
By: raffles
*** } else { // use netpm *** and exchange them with: *** } elseif ($this->_imageLib == 'netpbm') { // use netpm *** then go some lines below where it says: *** $returnChmod = true; *** leave the line as it is and add the following above: *** } elseif ($this->_imageLib == 'gdlib2') { // if set to gdlib2 if ($this->_keepOriginalImage) { $filename = $this->_fileUploadDirectory . '/'. $this->_getDestinationName (); $lFilename_large = substr_replace ($this->_getDestinationName (), '_original.', strrpos ($this->_getDestinationName (), '.'), 1); $lFilename_large_complete = $this->_fileUploadDirectory. '/' . $lFilename_large; if (!copy ($filename, $lFilename_large_complete)) { $this->_addError ("Couldn't copy $filename to $lFilename_large_complete. You'll need to remove both files."); $this->printErrors (); exit; } } $file=$this->_fileUploadDirectory . '/' . $this->_getDestinationName(); $old_picture = imagecreatefromjpeg($file); $new_picture = imagecreate($newwidth, $newheight); if (!imagecopyresampled($new_picture, $old_picture, 0, 0, 0, 0, $newwidth, $newheight, $imageInfo['width'], $imageInfo['height'])) $retval=1; if (!imagecreatetruecolor($new_picture, $this->_fileUploadDirectory . '/' . $this->_getDestinationName())) $retval=2; } else { // use gdlib1 if ($this->_keepOriginalImage) { $filename = $this->_fileUploadDirectory . '/'. $this->_getDestinationName (); $lFilename_large = substr_replace ($this->_getDestinationName (), '_original.', strrpos ($this->_getDestinationName (), '.'), 1); $lFilename_large_complete = $this->_fileUploadDirectory. '/' . $lFilename_large; if (!copy ($filename, $lFilename_large_complete)) { $this->_addError ("Couldn't copy $filename to $lFilename_large_complete. You'll need to remove both files."); $this->printErrors (); exit; } } $file=$this->_fileUploadDirectory . '/' . $this->_getDestinationName(); $old_picture = imagecreatefromjpeg($file); $new_picture = imagecreate($newwidth, $newheight); if (!imagecopyresized($new_picture, $old_picture, 0, 0, 0, 0, $newwidth, $newheight, $imageInfo['width'], $imageInfo['height'])) $retval=3; if (!imagejpeg($new_picture, $this->_fileUploadDirectory . '/' . $this->_getDestinationName())) $retval=4; } if ($retval > 0) { if ($this->_imageLib == 'imagemagick') { $this->_addError('Image, ' . $this->_currentFile['name'] . ' had trouble being resized: ' . $mogrify_output[0]); } elseif ($this->_imageLib == 'netpbm') { $this->_addError('Image, ' . $this->_currentFile['name'] . ' had trouble being resized: ' . $netpbm_output[0]); } else { $this->_addError('Image, ' . $this->_currentFile['name'] . ' had trouble being resized using '.$this->_imageLib.' - Errorcode' . $retval); } $this->printErrors(); exit; } else { $this->_addDebugMsg('Image, ' . $this->_currentFile['name'] . ' was resized from ' . $imageInfo['width'] . 'x' . $imageInfo['height'] . ' to ' . $newsize); } } ***
Posted on: 01/14/04 03:19am
By: Dirk
Posted on: 01/14/04 10:45am
By: raffles
Posted on: 01/14/04 10:56am
By: Dirk
Posted on: 01/14/04 11:03am
By: raffles