• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Images not displaying

New Here ,
Mar 04, 2008 Mar 04, 2008

Copy link to clipboard

Copied

Instead of posting this new Issue in the other topic i had about the similar system, because it is a separate issue I thought it'd be best to keep them separate.

Ok so basically a user uploads a file, I rename it and store it in an images folder and write the location of the image to a text field in the database. All goes well up to here, the full path to the file gets written to the database perfectly with the new filename etc,

However when I try to print the images things go wrong. according to the page source from when I test it the img src tag is perfect with the correct file path and everything, however no image gets displayed at all. Here is the code on fo it and then the page source code. Any ideas?

<cfoutput><img src="#Recordset2.prof_img#" alt="Default Profile Image" /></cfoutput>

pagesource:
<img src="C:\ColdFusion8\wwwroot\Portfolio_Project\images\userimgs\10040308021010.jpg" alt="Default Profile Image" />

This one has me stumped. Any help is greatly appreciated.
TOPICS
Advanced techniques

Views

283

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 04, 2008 Mar 04, 2008

Copy link to clipboard

Copied

Your src path is using a system directory path to the image file, Use something like the following, assuming the Portfolio_Project folder is a sub folder of your web site.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2008 Mar 05, 2008

Copy link to clipboard

Copied

All sorted thank you, I change the path to be relative to the site not the machine 🙂 Thanks again

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 05, 2008 Mar 05, 2008

Copy link to clipboard

Copied

LATEST
Yup. Since CF is server side, you need the path to be appropriate from the server's point of view, rather than from the client's point of view. This same principle confuses people when using tags such as CFFILE, etc.

I, personally, usually code it wrong the first time and than correct it when I get the error. You would think I would learn to do it right the first time!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation