Reply to Resizing GIF

Resizing GIF new!
by Sage, 16 years ago
I just came across this issue...
I am uploading a file to make a copy of it's original format, and creating a 150x150 thumbnail.
It works fine for jpg, png, etc... but when I do GIF, the thumbnail is created the same size as the original... not 150x150.

here is the section of code where the processing is happening:
$handle->allowed = array('image/*','video/*');
$handle->file_new_name_body   = $sNewSectionFileName;
$handle->Process($sUploadDir);
$sSavedFileNameBody = $handle->file_dst_name_body;
$sSavedFileNameExt  = $handle->file_dst_name_ext;

// check if file image processed
if (!$handle->processed){
  // if error reported
  $sErrors .= $handle->error;
} else {
  // define image mime types that will be thumbnailed
  $aAllowedMimeTypes = array('image/jpg','image/jpeg','image/png','image/gif','image/bmp');
  // create thumbnail if file mime type is an image
  if(in_array($handle->file_src_mime, $aAllowedMimeTypes)){
    // otherwise if main image processed without error, create the thumbnail
    $handle->file_new_name_body     = 'thumb_'.$sNewSectionFileName;
    $handle->image_resize           = true;
    $handle->image_ratio_no_zoom_in = true;
    $handle->image_border           = '1px';
    $handle->image_border_color     = '#CCCCCC';
    $handle->image_background_color = '#FFFFFF';
    // default: 150 - don't need to set unless if different
    //$handle->image_x                = 150;
    //$handle->image_y                = 150;

    $handle->Process($sUploadDir);

    // check if thumbnail processed
    if (!$handle->processed) {
        // if error reported
        $sErrors .= $handle->error;
    }
    $bThumbCreated = TRUE;
  }
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important