We help IT Professionals succeed at work.

Can't seem to pull image source from database?????

loki421
loki421 asked
on
231 Views
Last Modified: 2013-12-24
Hi all!  

I can't see what's going wrong here people, i have a MySQL data base that stores the name of the image while the image is stored in a temp folder on the server.  The problem is when i try to display the data on a dynamic page (made in DW CS3), it doesn't show the image.  So what's going wrong?  I have several text feilds that all display fine, but the image won't display????

Anybody have any experiance with displaying dynamic images on the web???  I'd really like to hear from you if you do :-)

Many thanks in advance guys & gals!

<cfoutput query="rsCars">
          <table width="268" border="0">
            <tr>
              <td width="262"><p class="style3">&nbsp;</p>
              <p>&nbsp;</p></td>
            </tr>
            <tr>
              <td><div align="left"><img src="temp/#rsCars.image#" alt="car" width="100" /><span class="style3">#rsCars.vehicle_description#</span></div></td>
            </tr>
            <tr>
              <td nowrap="nowrap">Business Price: <span class="style3">#rsCars.business_price#</span></td>
            </tr>
            <tr>
              <td nowrap="nowrap">Personal Price: <span class="style3">#rsCars.personal_price#</span></td>
            </tr>
          </table>
        </cfoutput>

Open in new window

Comment
Watch Question

Commented:
What you are doing should work fine.

before the cfoutput
put a

<cfdump var="#rsCars#" />

To check that the url is indeed coming out of the query and pointing to the correct image path, also ensure you can browse to that path manually and see the image.

Author

Commented:
Yep, it can 'see' the image fine, it displays the name of it ok.  And i can browse to the folder and see the images myself.  This is still in the development phase at the moment and i'm running it all locally on my laptop, don't know if that'll make any difference?

Here's a screenshot of the data...
screenshot.jpg

Author

Commented:
Oh, and here's a screen shot of how it displays....
screenshot2.jpg

Commented:
Looks like your doing it right and the path is just wrong to the image.


Are your images really located in a temp directory under the webroot

can you browse to one

http://www.yourdomain.com/temp/fiat.jpg

Commented:
I think that temp isn't located under the webroot.

Author

Commented:
Here's the path of the temp folder:  C:\ColdFusion8\wwwroot\new_site_development\temp (it's all hosted locally at the moment and not live).

This is where the images are stored.  In the admin site, the name of the image goes to MySQL and then on the next page you upload the file to this directory.  I double check the db to confirm that the image name is in there correctly, and then use temp/#rsCars# to try and display them, but it's just not working, would there be something i'm missing somewhere?  Maybe on the CF server?  Or on one of the pages somewhere?  I'm really scratching my head here! :-(

You got any ideas? :-)

Author

Commented:
Sorry, meant temp/#rsCars.image#

Commented:
Can you browse to the image manually?

If so what is the url ie

http://localhost/new_site_development/temp/fiat.jpg

you could try the full url below

<img src="http://localhost/new_site_development/temp/#rsCars.image#" alt="car" width="100" />

Author

Commented:
Just tried both, and neither works!!!   Fustrating isn't the word!! :-)

What am i missing?!  just checked the images in the temp folder, they match exactly what it says in the db.

Would you like to see the whole code for the page?
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Ah ha!!  Success!!!  Might help to put the port in the address hey!!! lol :-)

All sorted now mate, thaks for all your help and time..... 500 point comin your way :-) :-)

Really appreciated :-)

Author

Commented:
Thanks for your time pal, really helped :-)

Commented:
glad you got it sorted.

Author

Commented:
Yep!  Me too, was starting to lose faith :-)  Just need to figure out how to horizonaly loop the data now!!  So will probably be back here in a couple of days :-)!!!

Take care :-)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.