rifanece / timthumb

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

Wrong behaviour when one dimension is not specified #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
- Using timthumb without specifing width or height

What is the expected output?
- The other dimension should be calculated.

What do you see instead?
- The other dimension is set to a default value of 100

There's a quick fix for the problem: set the other dimension to zero.

So for example:

timthumb.php&w=300h=0&src=image.jpg

In this case timthumb calculate the height.

Or change lines 32 and 33 from

$new_width = preg_replace( "/[^0-9]+/", "", get_request( 'w', 100 ) );
$new_height = preg_replace( "/[^0-9]+/", "", get_request( 'h', 100 ) );

to

$new_width = preg_replace( "/[^0-9]+/", "", get_request( 'w', 0 ) );
$new_height = preg_replace( "/[^0-9]+/", "", get_request( 'h', 0 ) );

Regards,

Valentino Aluigi

Original issue reported on code.google.com by valentin...@gmail.com on 20 Jan 2009 at 11:33

GoogleCodeExporter commented 8 years ago

Original comment by BinaryMoon on 14 Mar 2009 at 9:17