Avatar

imagecopyresampled() (Features)

by Milo ⌂, Saturday, June 01, 2013, 16:12 (1574 days ago) @ Alfie

Hi,

This has a drawback if an image is within the dimension limits but the file size is too large.
Example: max dimension 640px, max filesize 100KB.
If an image is 300px wide and its filesize is 101KB it will be upscaled to 640px

I study the code and I can't confirm your description of the problem:

 
// get image size
$image_info = getimagesize($_FILES['probe']['tmp_name']);
$width=$image_info[0];
$height=$image_info[1];
 
// resize image, if it is too large
if($width > $settings['upload_max_img_width'] || $height > $settings['upload_max_img_height']) {}
 
// in your case, it is not to large, thus:
else
  {
    $new_width=$width;
    $new_height=$height;
  }
 
// calling resize_image-function to compress image
resize_image($_FILES['probe']['tmp_name'], $uploaded_images_path.$img_tmp_name, $new_width, $new_height, $compression)

regards
Micha

--
Surveyor-Software: Geodetic Network Adjustment & Deformation-Analysis and Transformation


Complete thread:

 RSS Feed of thread

powered by my little forum