Image operations";
$image->scale(40); //scales the image 40%
$image->dump(); // this is a debug function only do not use this for production purposes
$image->scaleToHeight(1024); //scales the image keeping height 1024
$image->dump();
$image->scaleToWidth(1024); //scales the image keeping width 1024
$image->dump();
$image->resize(1024,768); //resizes the image to a given size
$image->dump();
/*
* Image Attributes
* */
echo "
Image Attributes
";
$new_wdith = $image->getWidth();
$new_height = $image->getHeight();
echo "Width is : $new_width
";
echo "Height is : $new_height
";
/*
*change format save to disk
* */
$image->save("/home/imal/Desktop/images/newImage.jpg",IMAGETYPE_PNG); //change the url according to yours
/*
* other usefull operations
* */
echo "Other usefull operations
";
$base64URL = $image->getDataURI();
echo "
";
/*
Image class will not return anything for following methods but in Shape classes it will be a new Image
to keep the idea of Shape Consistant
*/
$image->crop(100,100,300,300);
$image->dump();
$image->merge(new Image("./city.jpg"),100,100);
$image->dump();