class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
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?
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,
martina