2011-06-30, 18:50:51
ok, the problem above was caused by $width and $height values in function imagecopyresampled($dst, $src, 0, 0, $cx, $cy, $dwidth, $dheight, $width, $height)
it needs image source dimensions, not destination ones (I set $width = 150, height = 100).
so I added 2 more variables with imagesx and imagesy functions to get the dimensions of source image and used them in imagecopyresampled function. that's it.
but some thumbnails were stretched.
so I changed the code to make a crop (found a good example here: http://www.gidforums.com/t-21016.html)
and now is ok.
I should update the new code with the control on maxHeight / maxWidth, but I don't actually need it.
it needs image source dimensions, not destination ones (I set $width = 150, height = 100).
so I added 2 more variables with imagesx and imagesy functions to get the dimensions of source image and used them in imagecopyresampled function. that's it.
but some thumbnails were stretched.
so I changed the code to make a crop (found a good example here: http://www.gidforums.com/t-21016.html)
and now is ok.
I should update the new code with the control on maxHeight / maxWidth, but I don't actually need it.