I\'m using a neat little php script to resize my images to fit in a 300x300 pixel square, while keeping the aspect ratio. I got the script from here.
Here is the whole s
you cannot do resizetowidth and then resizetoheight.
this will in fact resize it to 363x300.
create a new function which preserves the aspect ratio:
function scale_kar($maxwidth,$maxheight) {
$width = $this->getWidth();
$height = $this->getheight();
if($width > $height) {
$ratio = $maxwidth / $width;
$height = $height * $ratio;
$this->resize($maxwidth,$height);
}
if($width < $height) {
$ratio = $maxheight / $height;
$width = $width * $ratio;
$this->resize($width,$maxheight);
}
}
then call it with:
$image->scale_kar(300,300);