Force maximum width and height for PHPThumb images

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2010-04-12T03:08:32Z Indexed on 2010/04/12 3:13 UTC
Read the original article Hit count: 393

PHPThumb provides two great variables setting the output maximum width and height BUT "This is always overridden by ?w=_ GETstring parameter"

$PHPTHUMB_CONFIG['output_maxwidth'] = 720;
$PHPTHUMB_CONFIG['output_maxheight'] = 720;

You can also set defaults, and for landscape/portrait:

$PHPTHUMB_DEFAULTS['w']    = 720;
$PHPTHUMB_DEFAULTS['h']    = 720;
$PHPTHUMB_DEFAULTS['hp']    =  720;
$PHPTHUMB_DEFAULTS['wl']    =  720;

You can set the getsringoverride to enforce the default width/height but then you can't have width/height smaller than the default.

$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = false;

There doesn't seem to be a way to allow the get paramaters to be used but if entering a value higher than the output_maxwidth/height it outputs that size, not the maximum.

How can the output be explicitly restricted to a maximum size, hence protecting the source images?

© Stack Overflow or respective owner

Related posts about phpthumb

Related posts about maximum