PDA

View Full Version : Resize only if image is larger?


DeadKenny
23rd of May 2006 (Tue), 10:00
I couldn't find an answer with search so don't know if this has been addressed already, but is there a way of getting EE & ImageMagick to only do resizes if the image is larger than the target image?

Actually I know ImageMagick can do this, but does EE have support for it or can I specify it through options or hacking a PHP file somehow? I couldn't see any options in EE but I might have missed something.

Pekka
23rd of May 2006 (Tue), 12:27
I have not added such restriction because of freedom of choice: you can always use percentage based resize methods. And I do want to make it possible to enlarge as well.

Technically doing such a limiter is easy. Just add into RESIZE_get_resize_info.php replace

if ($method == "NONE") {

with something like (untested)

if (($original_width >= $resizemethod_x) AND ($original_height >= $resizemethod_y)) {
$method = "NONE";
}

if ($method == "NONE") {

DeadKenny
23rd of May 2006 (Tue), 19:41
That works (though I had to change to '<=' to do what I want :D).

Many thanks:D