Michdd Posted May 12, 2009 Share Posted May 12, 2009 What's the best way of getting an image extension from an outside source? (url). I need to be able to get the extension from the URL of an image so I can use it so save it using copy() I tried to create a temporary instance of it using imagecreatefrom*() then use getimagesize with mime, but that's not a good solution since I don't what which imagecreatefrom*() to use until after I get the extension. Link to comment https://forums.phpfreaks.com/topic/157760-image-file-extension-from-an-outside-location/ Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 $extension_dot_loc = strrpos($filename, '.'); if ($extension_dot_loc !== false) echo substr($filename, 0, $extension_dot_loc); That's how I would tackle it. Link to comment https://forums.phpfreaks.com/topic/157760-image-file-extension-from-an-outside-location/#findComment-832150 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.