FIle Type over HTTP
-
Is it possible to easily find the file type (or mime type) returned by a url?
If I am running a script from example.com and I have url on a different domain (i.e. https://www.foo.com/images/snow.pl) which returns a .gif image, how can I determine whether or not it is an image file.
I’m trying to avoid having to download the file, stick it in a temporary directory, use getimagesize() to get its mime type and then delete the file. That seems like an awful lot of overhead, just to find out if the file displays an image.
From my research, I am supposed to be able to use getimagesize() to do this remotely, but it seems to be disabled on my (shared) web server.
I have the GD2 library installed on this server, but I can’t find anything that will get me a mime type for an in-memory file. I only need to identify .gif or .jpg files, but an “image or not image” solution might work also.
Thanks,
Charles
- The topic ‘FIle Type over HTTP’ is closed to new replies.