retrieve image from directory

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: retrieve image from directory

Post by egami » Thu Feb 17, 2011 6:59 am

What is it that you are trying to do?
I don't recommend storing images inside a db.. only the image name.

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Re: retrieve image from directory

Post by Nullsig » Tue Feb 22, 2011 9:39 am

What they are trying to say is:

The recommended method for this is to store all of your images in a folder on your server for this example we will use a folder called "images" just inside your public_html folder

Now store just the file name (preferably with the extension unless you are only using one image type) into a field in your database

Lastly, you want to query for the image's file name and insert it into either a relative url:
<img src='/images/$filename'>

or into a fully qualified url:
<img src='http://www.<host>.com/images/$filename'>

Now if you are trying to use an image to query a database you can still do that, but you would need to get the image's file name and query based on that.

If you meant that you want to use an Image File as a query variable... you shouldn't do that.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest