0

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 ?

shri_wahal
  • 328
  • 1
  • 4
  • 15

1 Answers1

1

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.

MaGnetas
  • 4,688
  • 3
  • 30
  • 50