check for existence of an image on another website and display if there

Posted on 2007-07-24
Medium Priority
Last Modified: 2012-06-22
I am want to display images from the MLS on my website.Downloading all the images and then uploading them to my server is a waste of time. Each listing has a different # of photos. The only thing that changes is the subdirectory for each photo.


Is there a to check for the existence of the photo? I tried the following and obviously it was the incorrect approach:

<cfif FileExists("http://www.sancapmls.com/san/jpg2/#MLSNum#.jpg")>
            <img src="http://www.sancapmls.com/san/jpg2/#MLSNum#.jpg" />
Question by:semerj
  • 2
LVL 39

Expert Comment

ID: 19559828

 FileExists would take the physical directory, not the URL

So this ..
<cfif FileExists("http://www.sancapmls.com/san/jpg2/#MLSNum#.jpg")>

Would be something like this...

<cfif FileExists("c:\inetpub\wwwroot\san\jpg2\#MLSNum#.jpg")>


Author Comment

ID: 19560109
That won't work, hence my question. The files I am trying to pull are not on the same server as the website where I want to display them.
LVL 39

Accepted Solution

gdemaria earned 500 total points
ID: 19561594

I missed the "image on another website" in the title..

 You can use <cfhttp>  to pull the image over, if its not there, it will return an error code.  


Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question