troubleshooting Question

detect if image exists

Avatar of J N
J N asked on
PHP
13 Comments2 Solutions7988 ViewsLast Modified:
Hi,

i am working with some external data from twitter and occasionally it displays a link to an image in one of its array values.

If i try and use the img tag and display the image i get an empty field.

i am curious if it is possible to test if the link is an image file. i have tried using file_get_contents however the page loads very slowly but it does work.

i am wondering if i could use is_file or file_exists with a url such as

https://pbs.twimg.com/profile_banners/334036628/1395969403

to determine if the file exists as it is not always the case

thanks in advance
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 13 Comments.
Start Free Trial
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 2 Answers and 13 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