Sample ImageHelper Usage

PHP: ImageHelper

ImageHelper is a simple PHP class that save, resize and/or crop photos. You can download the script in the links listed below.

ImageHelper download link

Sample Usage :
$image = new ImageHelper();
$imageThumb = '../images/thumb/' . $imageID . '.jpg';
$image->saveImage( $url , $imageURL );
$image->resizeCrop( $imageThumb , $imageThumb , '1:1' , '75x' );

$imagePreview = '../images/preview/'. $imageID . '.jpg';
$image->saveImage( $url , $imagePreview );
$image->resizeCrop( $imagePreview , $imagePreview , null , '250x150' );
saveImage( $url , $serverURL ) saves an image from a URL. The function uses cURL to copy an image from the URL then save it to the server’s folder. $url – URL to get the image $serverURL – server URL to save the image resizeCrop( $loadPath, $savePath , $crop , $size ) resize and/or crop the image from a URL. The function uses PHP’s GD and image functions using the $crop and $size parameter. $loadPath – path where the image is on the server $savePath – path where the image should be saved on the server $crop – crop ratio $size – image size