Link to home
Start Free TrialLog in
Avatar of Sri10
Sri10

asked on

image not displayed when executed coldfusion

Hi developers,
I have created one cfm page and where in i am calling an image into a table cell . the image is actually stored in my coldfusion server in a folder called "image".

when I execute the cfm page from localhost:8500/.....cfm, the page is getting loaded perfectly but the image is not displayed but an image icon is displayed with the image name. plz see the attached file.

If I see view source of the page and save the code in a notepad with aaa.html, and saved i in desktop and executed, and now image is displayed. i dont understand why?
The image code:
 
<td> <img src="C:\ColdFusion8\wwwroot\sitename\images\sample.jpg"  />

Open in new window

sample.JPG
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hmmm... the image you uploaded does not look valid.  It is not displaying properly even on EE.
Avatar of Sri10
Sri10

ASKER

this works.. thank you
Can I ask, why the "B" grade?  Did you have further questions?
Avatar of Sri10

ASKER

yeah, I got the page working. but still I did not undertsand, why if I give full path as
C:\ColdFusion8\wwwroot\sitename\images\sample.jpg, the image is not displayed??

image is displayed only if i give as
sitename\images\sample.jpg
Ah, okay.  Well, if you ever clarification about an expert's response - feel free to ask.

> image is displayed only if i give as
> sitename\images\sample.jpg

Well, since it is a web application you should not use a physical path ("c:\ColdFusion8\...").   You need to use some kind of url:  

http://localhost:8500/somefolder/images/sample.jpg
/somefolder/images/sample.jpg
.../images/sample.jpg

IIRC, physical paths treated as relative to the client machine. Meaning if I went to your website and viewed the page, it would look on _my_ computer for the file path c:\coldFusion8\... and _not_ your CF server.  So the page would only ever work on the machine where CF is installed.  Also, I believe some browsers disable this for security reasons, anyway.  In which case it may not work at all.
Avatar of Sri10

ASKER

thanks agx, for the clarification. I don;t know how to change the grade from b to A.. but if there is a way, I will surely do it. Thanks..
You do not have to change it.  I mentioned it because it seemed like part of your question was not answered.  So I just wanted to make sure you knew you could always ask for more details if you need them :)