cristianogois / timthumb

Automatically exported from code.google.com/p/timthumb
1 stars 1 forks source link

Set Max W and Max H proportional, not Max W or Max H #142

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I wish one feature:

On the Example (http://www.binarymoon.co.uk/demo/timthumb-basic/) i wish 4 and 
5 as one Option.

Example:
So i can set Max W (maxW=300) and Max H (maxH=200).

If a picture 400x300 and as Thumbnail 267 W x 200 H keep the picture in 
proportion
If a picture 700x600 and as Thumbnail 300 W x 129 H keep the picture in 
proportion

Now i set only W or H as Max (like Example 4 or 5). But i want to set W and H 
as Max. Without Zoom and Cut of the picture (like Example 1,2,3,6,7) 

Original issue reported on code.google.com by comlo...@googlemail.com on 17 Dec 2010 at 12:39

GoogleCodeExporter commented 9 years ago
Exactly, I downloaded from svn today, and made few changes in the code to 
behave like that:
before the line ~128 "$canvas = imagecreatetruecolor ($new_width, $new_height);"

I added this code, to avoid a image to stretched when the size is less than the 
max:
    if ($new_width > $width || $new_height > $height) { 
        $new_width = $width;
        $new_height = $height;
    }

    // create a new true color image
    $canvas = imagecreatetruecolor ($new_width, $new_height);

Original comment by hiddenat...@gmail.com on 14 Feb 2011 at 7:20

GoogleCodeExporter commented 9 years ago
Hi - this is now in the core theme. More info here: 
http://www.binarymoon.co.uk/2011/03/timthumb-proportional-scaling-security-impro
vements/

Original comment by BinaryMoon on 4 Apr 2011 at 7:59