How to not enlarge the image

See all posts Reply

How to not enlarge the image new!
by Chan, 9 years, 7 months ago
I want to limit the max image width to 400, therefore, If I upload a image 1000 x 1000, it should be 400 x 400, if I upload 300 x 300, it should remained 300 x 300, but image always re size to 400 x xxx, here is my setting, how to implement that?

$foo->file_new_name_body = $newName;
$foo->image_convert = 'jpg';
$foo->jpeg_quality = 100;
$foo->image_resize = true;
$foo->image_x = 400;
$foo->image_ratio_y = true;
$foo->image_ratio_no_zoom_out = true;
Reply
Re: How to not enlarge the image new!
by colin, 9 years, 7 months ago
You cannot use two image_ratio_xxxx properties at the same time. In fact, you cannot have a "no_zoom_out" effect if you are using image_ratio_y, it is a known shortcoming.Reply
Re: How to not enlarge the image new!
by Chan, 9 years, 7 months ago
Any solution to accomplish my goal?Reply
Re: How to not enlarge the image new!
by colin, 9 years, 7 months ago
I am afraid you will have to do it outside the class, using image_src_x and image_src_y to check whether you need to resize or not.Reply
Re: How to not enlarge the image new!
by Chan, 9 years, 7 months ago
It's works for me, thanks
$foo->file_new_name_body = $newName;
$foo->image_convert = 'jpg';
$foo->jpeg_quality = 100;
if ($foo->image_src_x > $maxWidth) {
  $foo->image_x = $maxWidth;
  $foo->image_resize = true;
  $foo->image_ratio_y = true;
}
Reply