0

I would like to compress image from user. I thought I could use GD, so I wrote code like this.

   imagepng($_FILES['upload_file'], NULL, 6)

But this was wrong. Can I compress image from user with imagepng? (I dont have to save this file from user because I write the code in other place.) Please tell me.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
HAYATO SHIBA
  • 151
  • 1
  • 14
  • You had better tell us exactly what you mean by compress. Do you mean something like zippping the image, or do you mean making the image into a thumbnail for example – RiggsFolly Feb 04 '18 at 14:18
  • I know jpg has compression levels, but I was unaware of png having them... unless you mean reducing the image size, or color bit table, or stripping previews/xinfos/etc... – IncredibleHat Feb 04 '18 at 14:26
  • I would like to reduce the volume of data. For example, if user upload 3mb image, I would like to reduce the volume and save the file with like 1mb. – HAYATO SHIBA Feb 04 '18 at 14:37
  • Possible duplicate of [Use PHP to convert PNG to JPG with compression?](https://stackoverflow.com/questions/1201798/use-php-to-convert-png-to-jpg-with-compression) – Alex Angelico Feb 05 '18 at 02:37

0 Answers0