troubleshooting Question

Get the Extension of the Image from URL

Avatar of Pedro Chagas
Pedro ChagasFlag for Portugal asked on
PHPRegular Expressions
17 Comments5 Solutions521 ViewsLast Modified:
Hi E's, I need to get the extension of the image from a URL address (gif, png, jpg etc).
In practice if I have this address: http://example.com/image/image.gif I want the output $extension = gif.

How I get the image extension from the URL?

Regards, JC
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 5 Answers and 17 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros