scm22ri — 2012-08-28T14:55:29-04:00 — #1
I'm not entirely sure how images would work with php. The images these types of websites have (below) do you believe the images are stored in a mysql database and called like everything else or are they stored differently? If so, how are they called?
<snip>picture of a car</snip>
<snip>picture of a truck</snip>
serverstorm — 2012-08-28T16:42:11-04:00 — #2
The recommended method of storing images in the database is to have your images located on your web-folder - say a path might be /var/www/my_site_folder/catalogue_images/.
You then store any uploaded automobile images in the catalogue folder and you store the web path in the database, so let say your domain is www.my_site.com then you would loop through or select a model of car (in the database) and grab its' image name and then using php append the path together.
$image_path = "./catalogue_images/$my_selected_image_name_from_the_db";
then where you need to display it:
$image = "<img src='$image_path' alt='$my_short_description_from_the_db' />
Hope this helps.
scm22ri — 2012-08-28T18:21:06-04:00 — #3
Thank you Steve. That was helpful.
blogaddition — 2012-09-19T06:34:17-04:00 — #4
We can also store the images in mysql database by converting them into binary data and then we have to make our database table image field "blob" type. and the image is stored but that is not better option. ServerStorm has answered correct.
system — 2014-10-07T22:56:19-04:00 — #5
This topic is now closed. New replies are no longer allowed.