Jump to content

storing and displaying image from database via filepath


Drumlegend
Go to solution Solved by KevinM1,

Recommended Posts

1. Are you sure your query is working?  Have you run it in phpMyAdmin?

2. Have you simply tried (with the code above)

echo "<img src=\"{$recipe['image']}\" /><br />";

??

The code you posted worked, I just needed to remove public_html from that path that was suggested. Thank you man!

Link to comment
Share on other sites

Seriously?

 

So on my machine, the full path of an image is C:\wamp\www\project\web\images\image.png.

 

My "web root" or the equivalent of public_html is C:\wamp\www\project\web

 

Are you trying to argue that the image url should be: C:\wamp\www\project\web\images\image.png and not images/image.png? Because if so my computer and every other one I've ever developed on must be special.

 

Yes, that's correct that an absolute path to the image onto the machine is "C:\wamp\www\project\web\images\image.png", but it's also true that an absolute path to this image onto the web server is "/images/image.png" , not "images/image.png" (it's a relative path) 

So, when we're starting to reach something with "/" that tells to the server that we're going to use an absolute path to this element.

Edited by jazzman1
Link to comment
Share on other sites

Ah....so sorry if I was misread your threads by saying:

 

If you want to store an image path to display the image in HTML, that IS the path you want.

 

 

PS. By the way, you are not rude and an arrogant girl ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.