problem generating thumbnail

See all posts Reply

problem generating thumbnail new!
by kryska, 11 years, 8 months ago
I get the first image cropped and perfectly resized. But i can`t see the problem with the thumnail...any help??? Please...

$handle = new upload($fname_original);        
if ($handle->uploaded) {  
  //Get the new coordinates to crop the image.
  $x1 = $_POST["x1"];
  $y1 = $_POST["y1"];
  $x2 = $_POST["x2"];
  $y2 = $_POST["y2"];
  $w = $_POST["w"];
  $h = $_POST["h"];
  
  $handle->mime_check = true;
  $handle->allowed = array('image/*');
  $handle->forbidden = array('application/*');

  $handle->file_new_name_body   = 'imagen_proy';        
  $handle->image_resize          = true;
  $handle->image_x               = 470;
  $handle->image_y               = 470;      
  $handle->image_precrop = array($y1, $handle->image_src_x - $x2, $handle->image_src_y - $y2, $x1);        
  $handle->process($dir_pics);               
    
  //thumbnail
  $handle->file_new_name_body   = 'thhimagen_proy';
  $handle->image_resize          = true;
  $handle->image_ratio_x         = true;            
  $handle->image_y               = 400;
  $handle->image_precrop = array($y1, $handle->image_src_x - $x2, $handle->image_src_y - $y2, $x1);
  $handle->process($dir_pics);        
  
  $handle->clean();
} else {
  echo 'error : ' . $handle->error;
}
Reply
Re: problem generating thumbnail new!
by colin, 11 years, 8 months ago
What is the problem exactly?Reply
Re: problem generating thumbnail new!
by kryska, 11 years, 8 months ago
I get the thumbail x and y correct, but whit white spaces rigth and left...and cropped not like the first image...

I just want an image like the fist one, but diferent resizing: must be max y= 400Reply
Re: problem generating thumbnail new!
by colin, 11 years, 8 months ago
Check the log produced by the class, it will tell you exactly what is being done on the image.Reply
Re: problem generating thumbnail new!
by kryska, 11 years, 8 months ago
Solved!!!!

Thank you!

$srcx =	$handle->image_src_x;
$srcy = $handle->image_src_y;
$handle->image_precrop = array($y1, $srcx - $x2, $srcy - $y2, $x1);

This way, is correct.

Without these lines, the second time cropping, the image_src_x and image_src_y, what not like first time.Reply