0

How to resize an image and convert to .jpg on upload? Basically something like the post here

How do I resize and convert an uploaded image to a PNG using GD

But i need to convert to JPG...

I tried imagejpeg() instead of imagepng() but it still saves it as png.

Community
  • 1
  • 1

3 Answers3

1

It that thread that you linked to, the accepted answer is converting to png like this:

imagepng($newImage, $destFile);

Your code would need to be only slightly different:

imagejpg($newImage, $destFile);

See the PHP docs and this thread for further reference:

Community
  • 1
  • 1
0

there is a ready to use class, u could try - http://wideimage.sourceforge.net/

Renato Ferreira
  • 51
  • 1
  • 2
  • 10
0

You could apply:

imagejpeg($this->image,$filename,$compression);