function thumb ($path, $savepath, $width=0, $height=0)
$size = getimagesize ($path);
// Check for JPEG
if ($size == 2)
$image = imagecreatefromjpeg ($path);
if ($width != 0 && $height != 0)
// Width and height are literal
else if ($height == 0)
// Height is determined from original aspect ratio
$height = round ($size / ($size / $width));
else if ($width == 0)
// Width is determined from original aspect ratio
$width = round ($size / ($size / $height));
$imageFinal = imagecreatetruecolor ($width, $height);
imagecopyresampled ($imageFinal, $image, 0, 0, 0, 0, $width, $height, $size, $size);
$return_value = imagejpeg ($imageFinal, $savepath, 80);
Should the need for support arise, there are numerous ways to get in touch with our support staff.
Our community forums are a source of Service Offering, Status, Maintenance, and Outage Updates, and a source of basic support and knowledge from both peers, and staff.
Try our help desk for quick and effective technical support.