I want to resize image to a fixed dimension(say 180 X 180) .No matter what the size of user input image is,I want the resized one to be stored in database and retreived later.
Is there any library/function available in PHP for the same ?
I want to resize image to a fixed dimension(say 180 X 180) .No matter what the size of user input image is,I want the resized one to be stored in database and retreived later.
Is there any library/function available in PHP for the same ?
I'd suggest looking into Intervention image if you don't wanna write anything yourself. It can use both GD or ImageMagick and has many built in functions that allow solving most of the trivial image problems with several lines of code.
As simple as that:
$img = Image::make('yourimage.jpg')
$img->resize(180, 180);
And then use either save
or encode
method based on your needs.