How to Resize an Image from Database or File Using Php
This implementation is done using php. Usually we resize image that we read from a local file, then save it locally. Flow: 1.) read from...
https://www.czetsuyatech.com/2012/03/php-resign-an-image-from-database.html
This implementation is done using php.
Usually we resize image that we read from a local file, then save it locally.
Flow:
1.) read from local image file and store in a php variable
2.) resize the image file using php functionalities
3.) save the image file locally
Now what if we want to read an image file stored in a database then save it locally in a disk.
Here we will use the class from this url:
http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/
Usually we resize image that we read from a local file, then save it locally.
Flow:
1.) read from local image file and store in a php variable
2.) resize the image file using php functionalities
3.) save the image file locally
Now what if we want to read an image file stored in a database then save it locally in a disk.
Here we will use the class from this url:
http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/
$resizeObj = new resize(); if(isFile($file)) { //load as file $resizeObj -> setFileName($newFileName); } else { //load as binary string, read from database $resizeObj -> setBinaryString($content); } $resizeObj -> resizeImage($width, $height); $resizeObj -> saveImage("resized-".$newFileName);
Post a Comment