problem with phpthumb

0

really do not usually post problems with the code but this and I have about 4 days without being able to resolve it, it is a parameter that I need but I can not find the solution, in php 5.3 works without problems but in php 5.5 I no longer it works, I'm working with phpthumb 1.7.14 wanting to resize an image to another size, the function is

function set_image_resize($filename, $width, $height) {

  $image_ext    = str_replace('.','', strtolower($this->get_filename_ext($filename)));

  require_once(DIR_MASTER_COMMON . 'includes/phpthumb/phpthumb.class.php');
  $phpThumb = new phpThumb();

  list($new_width,$new_height) = getimagesize($filename);

  if ( (($new_width < $width) && ($new_height == $height)) ||
       (($new_height < $height) && ($new_width == $width)) ) {
  } else {

    $phpThumb->setSourceFilename($filename);

    $phpThumb->setParameter('f', $image_ext);

    $phpThumb->setParameter('fltr', 'size|'. $width . '|' . $height);

    if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
       if ($phpThumb->RenderToFile($filename)) {

       }
    }
  }

  $phpThumb->resetObject();

  $img = imagecreatetruecolor($width, $height);
  $bgColor = imagecolorallocate($img, 255,255,255);
  imagefill($img , 0,0 , $bgColor);

  $phpThumb->setSourceImageResource($img);

  $phpThumb->setParameter('f', $image_ext);

  $phpThumb->setParameter('fltr', 'wmi|' . $filename . '|C|100');

  if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
     if ($phpThumb->RenderToFile($filename)) {
        imagedestroy($img);
        return true;
     }
  }

}
    
asked by Enrique Acevedo Perez 13.10.2017 в 05:18
source

0 answers