PNG resize based on calculated file size
Posted: Wed May 14, 2008 3:15 pm
I am allowing users to upload images which are stored in a mysql database. I allow all the image types that php supports and convert them to a PNG. To reduce the storage space required on the mysql server I resize them to a maximum width and height. The size of a PNG image is based not only on the resolution but the number of colors too though. Is there any free code available that would allow me to find what resolution I should convert the image to so that it's size is less than the maximum allowed by the database?
If I can't find anything I will just run a while loop of resizing the image until it is less than the maximum the mysql storage allows.
If I can't find anything I will just run a while loop of resizing the image until it is less than the maximum the mysql storage allows.