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
modplod
Forum Commoner
Posts: 45 Joined: Mon Feb 27, 2006 11:18 am
Post
by modplod » Sat Mar 11, 2006 3:37 pm
hi,
I need help with this.
I have this
Code: Select all
$out .= "<img src=\"thumbnail.php?id=12345\" width=\""."80"." height="."60".">";
which uses this
Code: Select all
<?php
header("Content-type: image/jpeg"); // act as a jpg file to browser
$oDatabase = mysql_connect("localhost", "user_id", "password");
mysql_select_db("your_database_name", $oDatabase);
$sQuery = "SELECT thumbnail FROM your_table WHERE id = $nId";
$oResult = mysql_query($sQuery, $oDatabase);
$oRow = mysql_fetch_array($oResult);
$sJpg = $oRow["thumbnail"];
echo $sJpg;
?>
now is there a way to do this without reading another file from the disk?
(mission = fewest disk reads per page view)
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sat Mar 11, 2006 3:49 pm
Store the image binary inside your script. I think it's retarded, but I've seen it done.
modplod
Forum Commoner
Posts: 45 Joined: Mon Feb 27, 2006 11:18 am
Post
by modplod » Sat Mar 11, 2006 4:01 pm
As thats way over my head and seems a little redundant to my objectives, I think I'll skip it