I want to store frequently-used graphic elements in a db and serve
them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking
etc not shown)
The relevant piece of the page:
<?php
echo
'<table><tr><td >
<img src="ImageFromD B.php?Image=Ima geIdentifer">
</td></tr></table>' ;
?>
ImageFromDB.php :
<?php
$imgname = $_GET['Image'] ;
$dset = mysql_query( 'SELECT imagebits FROM graphics_table
WHERE name="' . $imgname . '"' ) ;
$rec = mysql_fetch_row ($dset) ;
$browser = fopen( 'php://output', 'w') ;
header( 'Content-Type: image/png' ) ;
fwrite( $browser, $rec[0] ) ;
?>
I fingered through the docs and did some googling, but didn't find
anything obviously helpful. Many thanks for any insights.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking
etc not shown)
The relevant piece of the page:
<?php
echo
'<table><tr><td >
<img src="ImageFromD B.php?Image=Ima geIdentifer">
</td></tr></table>' ;
?>
ImageFromDB.php :
<?php
$imgname = $_GET['Image'] ;
$dset = mysql_query( 'SELECT imagebits FROM graphics_table
WHERE name="' . $imgname . '"' ) ;
$rec = mysql_fetch_row ($dset) ;
$browser = fopen( 'php://output', 'w') ;
header( 'Content-Type: image/png' ) ;
fwrite( $browser, $rec[0] ) ;
?>
I fingered through the docs and did some googling, but didn't find
anything obviously helpful. Many thanks for any insights.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
Comment