Dispalying JPG images from database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fari
Forum Commoner
Posts: 42
Joined: Thu Sep 19, 2002 8:41 pm
Location: Timmins - Ontario

Dispalying JPG images from database

Post by Fari »

Hi

I've been struggling :cry: to display an image stored in a 'blob' in a database. Could anyone post a working script for loading into and displaying???

Ta - Frank
User avatar
Slyvampy
Forum Newbie
Posts: 23
Joined: Thu Nov 28, 2002 2:03 am
Location: Yorkshire, England
Contact:

Displaying JPG images from database

Post by Slyvampy »

The way I did my pictures within my database, was to just put in the location of the image, not the actual image ($location_of_image).

File the image in a directory and in your PHP script output the $location_of_image as a part of the code example.

within the database:-

+---------------------------------------------------------+-----------------------+
- Location of Image                                            - ALT of Image -
+---------------------------------------------------------+-----------------------+
- http://www.slyvampy.com/images/image001.jpg - Image Details -
- http://www.slyvampy.com/images/image002.jpg - Image Details -
+---------------------------------------------------------+-----------------------+

Within the code:-

Code: Select all

<?php
echo "
<IMG SRC=/" $location /" ALT=/" $alt /" BORDER=/"0/"> ";
?>
that way your database size is decreased and you can point the images from anywhere.

Hope this helps,

SteJ.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Try searching this forum for 'blob AND image AND database' this has been discussed before (IIRC) so you may be able to find how others approached this.

Mac
Post Reply