Greetings All,

My clients ask if its possible to crop the images that where uploaded to a fixed
size, in this case 118x79

now he had landscape images, squares and portraits.

The code below is nearly perfect, its just that it always shows a little border when the orignal image isn't a standard crop; fe wideangle's, squares
or with squares the y axis isn't working out. it does work with portrait images though.

Basically whats needed is a script that crops the image so it always fit 118x79 disregarding what the original size was. and centering the image so no borders are shown.

any insights on this code ? a big big thanks in advance. its driving me bonkers atm.

PHP Code:

$height 79;

$width_orig$height_orig) = getimagesize($upload_image);

$ox $width_orig;
$oy $height_orig;
$nx 118;
$th 79;
$ny floor($oy * ($nx $ox));
// height * (thumbwidth / width)

$thumb imagecreatetruecolor($nx$th);
$source imagecreatefromjpeg($upload_image);
imagecopyresampled($thumb$source0$th - ($ny 2), 0, (-$ny 2), $nx$ny$width_orig$height_orig);