Thursday 21 July 2016

Resize images to a given width and height

This class can resize images to a given width and height.It can take a given GIF, JPEG and PNG image and resize it to a given width and height.The class can display the image as the current script output or save to a given file.The quality percentage of the resized image is a configurable parameter.


Example :


<?phprequire('../image_sizer.php');$img = new image_sizer();/**
 * setImage()
 * url : http://localhost/example1.php?img=https://upload.wikimedia.org/wikipedia/commons/c/c1/PHP_Logo.png
 *
 */
$img->setImage($_GET['img']);/**
 * setSize
 * New image size
 * $img->setSize(Width, Height)
 */
$img->setSize(10060);/**
 * show image
 *
 * $img->show(type, quality);
 * type : png, jpeg, jpg, gif
 * quality : image show quality 100 = 100%
 */
$img->show('png'100);



 Download

No comments:

Post a Comment