no

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...

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/
$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);

Related

php 7695027269758501034

Post a Comment Default Comments

item