If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Storing/updating images using db

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-09-08, 23:06
edoplaza edoplaza is offline
Registered User
 
Join Date: Oct 2008
Posts: 2
Question Storing/updating images using db

Hello everybody,

I'm new to this forum, and pretty new to databases. I use php MySQL and Dreamweaver. I have this problem: I need to create an efficient way to upload/update images in a website, like this:

http://www.centralmadeirense.com.ve/viveres.html

Until now the little icons, product info, prices, etc, are updated by hand!, one by one. I've been asked to create a form where the administrator could upload the icons, product info, etc. more efficiently and make them appear in the proper place (e.g. using a table like the example above). I'm sure this can be achieved using a dynamic site.

I know one can store all this info into a db, including the pics. But after reading some tutorials, I find them too hard (the storing pics directly in the db part). Is there a way to just store the pics in a folder of my server, and then use the db to manipulate this information? I don't really need to store the actual images into the db, just a link to them.

Let's be more specific. I know how to create a recordset and bind the name, price, and description of the product into an php document. I know even how to create a form to do all this automatically. But I don't know how to bind the images located in a folder of my server and "paste" them into the proper place into the php document.


Any help would be appreciated

Eduardo
Reply With Quote
  #2 (permalink)  
Old 10-10-08, 04:44
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
store the path to the image in the db and extract that to create the page along aith the other data. how you would do that in Dreamweaver is a mystery to me.. I tend to ue it only for static pages so Im not up to speed on or even if you could within Dreamweaver.

a few things to bear in mind with storing the path and NOT the image
1) you need to cater for the situation where the image is not found.. in my books nothing looks tackier on a website than an image not found icon... better to replace with an image not available or no picture at all
2) you don't have any control over the images, so the images could be edited or deleted or replaced.. that is a problem in as much a malicious attacker could replace your imnage with one of theirs. this can be got round
by carefull control of who has access to the image area of your filesystem.

there are advantages
you can link to pictures outside your site
images may get cached at the ISP level, meaning lessload on your server
your db doesn't bloat with information such as images, leading to reduced db size, backup times etc...

there are libraries such as the GD library in PHP which help with image manipulation
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 10-10-08, 12:16
edoplaza edoplaza is offline
Registered User
 
Join Date: Oct 2008
Posts: 2
Hey man, thanks!

So, is it as simple as that? Do I use an absolute path like http://www.mysite.com/images/image.gif?
Then how do I place it in a particular spot of my php doc?, for exaple, a table cell or a div.

Eduardo
Reply With Quote
  #4 (permalink)  
Old 10-10-08, 12:38
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
Quote:
Originally Posted by edoplaza
Hey man, thanks!

So, is it as simple as that? Do I use an absolute path like http://www.mysite.com/images/image.gif?
Then how do I place it in a particular spot of my php doc?, for exaple, a table cell or a div.

Eduardo
thats the problem I foresee.. how you instruct Dreamweaver to insert the PHP varaible


<img src="http://www.mysite.com/images/image.gif" alt="Angry" />
or
<img src="http://www.mysite.com/images/image.gif" alt="text description of your image" />

have a look a w3schools bit on the img tag
ideally you should alwasy put an ALT paraemter, and its reccomended that you also specify the image height & width

you can escape the double quote " in PHP by using \"m, the \ acts as an escape character
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On