Displaying an image from a database

This is a discussion on Displaying an image from a database within the PHP General forums, part of the PHP Programming Forums category; I have created a content management system for a web site and want some help with the most efficient way ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-05-2008
Kenoli
 
Posts: n/a
Default Displaying an image from a database

I have created a content management system for a web site and want
some help with the most efficient way to display images that are
stored in a database.

The way, it seems, that php displays images in a web page is with a
link to a php "image" file with an image header and script which
displays the image. The the src of an <img> tag points to that file
and obtains the image for display on a web page. I have several
database tables containing records with images that need to be
displayed on various web pages.

At present, I have a separate image file for each database. I obtain
an image from each table by sending the record key to that file with a
GET. The "image" file then retrieves the image from the table it is
associated with using that key obtained via the GET and displays it.
This requires me to have a separate file for each table in the
database from which I retrieve images.

I'd like to simplify this, obtaining images from all tables with only
one "image" file, rather than one for each table. If I first retrieve
the image data and send it to a generic "image" file for display, it
means sending a lot of data to the file displaying the image, which is
often too much for a GET.

Another way I can do this is to send the appropriate query to the file
in a variable which the "image" page will use to retrieve and display
the image I need. I feel a bit insecure sending a valid query via a
GET. Otherwise, I could sent the key, tablename, and imagefieldname
via a GET that the image file assembles into a query for retrieving
the image. Same issue.

I keep thinking there must be a way to do this that is simpler, secure
and more efficient than the one I am attempting.

Can anyone help me figure out the most efficient and secure way to
accomplish what I am trying to do?

Thanks,

--Kenoli


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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:24 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0