Image Resize Issue

See all posts Reply

Image Resize Issue new!
by Matto, 12 years, 9 months ago
Hi,
I can run the scrip and it save the image - only it isn't resizing them ;(

This is what I have so far
include('class.upload.php');
$handle->mime_fileinfo = false;
$foo = new Upload($_FILES['image']);
$handle->mime_fileinfo = false;
if ($foo->uploaded) {
  // save uploaded image with no changes
  $foo->Process('../images/products/test/');
  if ($foo->processed) {
    echo 'original image copied';
  } else {
    echo 'error : ' . $foo->error;
  }
  // save uploaded image with a new name
  $foo->file_new_name_body = $seo_name;
  $foo->Process('../images/products/l/');
  if ($foo->processed) {
    echo 'image copied ';
  } else {
    echo 'error : ' . $foo->error;
  }
  echo '
';
  // save uploaded image with a new name,
  // resized to 100px wide
  $handle->mime_fileinfo = false;
  $foo->file_new_name_body = $seo_name;
  $handle->file_overwrite = true;
  $foo->image_resize          = true;
  $foo->image_ratio_fill      = 'R';
  $$foo->image_ratio_y         = true;
  $foo->image_x               = 295;
  $foo->Process('../images/products/m/');
  if ($foo->processed) {
    echo 'image renamed, resized x=295 ';
  } else {
    echo 'error : ' . $foo->error;
  }
  echo '
';
  // save uploaded image with a new name,
  // resized to 100px wide
  $handle->mime_fileinfo = false;
  $foo->file_new_name_body = $seo_name;
  $handle->file_overwrite = true;
  $foo->image_resize          = true;
  $foo->image_ratio_fill      = 'R';
  $foo->image_y               = 145;
  $foo->image_x               = 115;
  $foo->image_convert         = 'jpg';
  $foo->jpeg_quality          = 80;
  $foo->Process('../images/products/s/');
  if ($foo->processed) {
    echo 'image renamed, resized x=115 and y=145 ';
    $foo->Clean();
  } else {
    echo 'error : ' . $foo->error;
  }
}
Reply
Re: Image Resize Issue new!
by colin, 12 years, 9 months ago
You should check the log produced by the class.

But you code is strange... Why are you using $handle when you instantiated the class with $foo? Also, why are you using mime_fileinfo? You cannot use it like this.Reply