Reputation: 8219
In PHP, there are two functions, image_type_to_extension and image_type_to_mime_type, however, I am looking for the oppsite. Is there something like mime_type_to_image_type so I can retrieve the type from the mime (I only have image/jpeg, or image/png, and like to eventually get the extension)?
Please note that I cannot use exif_imagetype or getimagesize because the hosting server does not allow it. The php setting allow_url_fopen is turned off for security reasons.
Thanks.
Upvotes: 0
Views: 2017
Reputation: 1468
You probably can use the Client URL Library (cURL) to extract this information from the raw data of the file. You can see some examples in this related answer.
Upvotes: 0