Reply to Problems with Resizing

Problems with Resizing new!
by Martina, 10 years, 2 months ago
hi,

i want to load an image and save it in two versions:

original load image: 620x414 pixel

version1: only height should be crop:
$handle->file_new_name_body = "620x280"
$handle->image_resize = false;
$handle->image_ratio_y = false;
$target_height = 280;
if($handle->image_src_y > target_height) {
  $padding = round (($handle->image_src_y - target_height) / 2);
  $handle->image_precrop = "$padding 0 $padding 0";
}        
$handle->Process($filedir);

version2: resizing image and height should be crop:
$handle->file_new_name_body = "300x160";
$handle->image_resize = true;
$handle->image_ratio_y = true;    
$handle->image_x = 300;            
$target_height = 160;
if($handle->image_src_y > $target_height) {
  $padding = round (($handle->image_src_y - $target_height) / 2);
  $handle->image_precrop = "$padding 0 $padding 0";
}
$handle->Process($filedir); 
$handle->Clean();

My Problem:
Imagesize of Version 1 is correct but the height of Version 2 is too less - it is only 142 pixel - but it should be 160 pixel!!!
In the second version the $handle->image_src_y is only 280 pixel but he should take the original image height ...

The image base for the transformation should always be the uploaded original image - but how can i do this?

regrads,
martinaReply

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