I am writing a thumbnailing script, and from what I’ve seen thumbnails tend to look best in the same format as their source. However, the script may be fetching images from the web, so I can’t access the file twice. So is there any way to get the file type other than exif_imagetype and other functions that have to re-open the image? I don’t want to rely on the extension as that can obviously be wrong.
I’m doing the thumbnail processing with GD, so something that uses the handle would be perfect, but I could also use the file’s contents. And yes, I’m aware that GD handles reference uncompressed data, but I’m not sure that they don’t remember what they decompressed from.
1 Answer