Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

retrieve image from directory

images php coding issues or problems here.

Moderators: macek, egami, gesf

retrieve image from directory

Postby evelyn1209 » Wed Feb 16, 2011 7:03 pm

I uploaded my images in the folder, do I need to create a table in the database?

Is it possible I retrieve the data from database with the image ?

:help:
evelyn1209
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Feb 16, 2011 5:44 pm

Re: retrieve image from directory

Postby 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
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

Postby Imranertaza » Mon Feb 21, 2011 7:31 am

What do you want to do in the project. Let make us understood and give your PHP and MYSQL code to get the perfect answer.

Thanks.
Imranertaza
New php-forum User
New php-forum User
 
Posts: 3
Joined: Mon Feb 21, 2011 12:07 am

Re: retrieve image from directory

Postby 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.
User avatar
Nullsig
php-forum Fan User
php-forum Fan User
 
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.