...

View Full Version : MYSQL Help displaying Images



ausnrl
07-18-2006, 07:23 AM
hello guys

well at the moment i am making a site and what is happening is this there is a form that you fill out and submit to a database. Now with the form there is a thing to upload images, a headline form and a message form. The headline is first hten the image uploader then the message. This is the tricky part. Should i on the page with the form put an image uploader in the form page and make the image upload and reload the page with the img tags which submit to the database (Do Img tags allow you to show images in mysql?) Or does anyone know any better ways i can show the article with the image used. That way the image is still uploading to the server but the link of the image is stored in the database and can be pulled out in [img] tags (if they can be used) A net article or any help is much appreciated!! :D

Thanks

Beagle
07-18-2006, 03:20 PM
I'm not sure what you're asking.

If you're asking whether or not you can store image data in a blob in MySQL and pull it out, the answer is yes, and the method is different based on what server programming language you're using. The basic principle is for a dynamic server page to send a header with the proper image type (like jpeg) and then stream the data from the mysql field.

If you're asking about whether or not you should display the image immediately after uploading, or something site design question, I don't know.

arnyinc
07-18-2006, 05:12 PM
The way I usually see this done is by uploading the image file to a web directory and storing the filename in your database. When you need to display the image you just display an img src with the filename in it:

<img src="/uploads/images/<? echo $uploadedfilename; ?>">

As beagle mentioned, you can also use BLOBs and store the images directly in your database. Depending on your webhost, you might not be allowed to store all kinds of data in your database (due to space constraints).

ausnrl
07-19-2006, 09:25 AM
Ok thanks for that

Now with the code <img src="/uploads/images/<? echo $uploadedfilename; ?>"> And it uploads to a database and say the Story name is Test and the image is testa.jpg will it display right image on say www.yoursite.com/article.php?id=1 would it display the right image?

ausnrl
07-20-2006, 05:20 AM
What if you put an iframe on the page with all the forms and made a form for image url which gave you the link to the image which you put in img tags and put with all other info in the row with the article in the database could you do it that way?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum