0

I am using ImageMagick with PHP to resize images (using its commandline tool "convert").

I am able to resize images and everything works.

What I want to do is I want to resize an image (of any dimension) to an image setting the minimum width and maximum height and at the same time preserve the image resolution/aspect ratio. How do I do this?

Why I want this: I am putting these images in a news feed in my website where I require images to be of width:100% but the problem is height becomes too large for certain images and occupies an entire page. I want to avoid it.

This is what I am using for resize:

$cmd="convert -thumbnail ".$width."x".$height." \"".$source."\" \"".$dest."\";";
1

1 Answer 1

0

You can find the resize options on the Imagemagick website: http://www.imagemagick.org/script/command-line-processing.php#geometry

I do not think these will achieve what you want so I would check the dimensions of your image and calculate the height to go with your width which you can use in your convert code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.