@clairec666Apr 30.2005 — #Hi. Here is a little sample code from my website:
I can't remember exactly how it works. But at quick glance, it seems that it rejects all GIF files, and converts all PNG and JPEG files to a similar size. With a bit of experimentation, you can change the size limits of the resultant image so that it is close to 80kb.
You will also need to change the upload path, and some other stuff.
I would like to calculate [FONT=Lucida Console]$compression[/FONT] using the size of [FONT=Lucida Console]oldimage.jpg[/FONT] so it always returns an image of around 80kb, but I don't know how to calculate this!
@SpectreReturnsMay 01.2005 — #Actually, that last parameter is 'quality', which is close, but not quite compression. The only way I can think of doing this is to create 10 versions of the file, each with 10 more quality rate, then do a filesize check on it to see which is closest to 80, afterwards deleting the others.
Edit: oh wait, this might calculate it for you: <i> </i>80 / filesize * 100