= $width) { $dwidth = $s; $dheight = floor(($dwidth / $width) * $height); } else { $dheight = $s; $dwidth = floor(($dheight / $height) * $width); } //Temp plaatje in geheugen om te resizen $temp = ImageCreateTrueColor($dwidth, $dheight); imagecopyresized($temp, $src, 0, 0, 0, 0, $dwidth, $dheight, $width, $height); $helft = ($s /2); //x en y as voor vierkantje $tx = (($dwidth / 2) - $helft); $ty = (($dheight / 2) - $helft); //dest aanmaken $dest = ImageCreateTrueColor($s, $s); //Progressive JPEG maken Imageinterlace($dest, 1); //Vierkantje uit het midden snijden imagecopy($dest,$temp, 0, 0, $tx, $ty, $s, $s); //Uitpoepen imageJPEG($dest); ?>