> -----Original Message----- > From: Anders Norrbring [mailto:lists@xxxxxxxxxxxx] > Sent: Monday, November 03, 2008 8:56 AM > To: Boyd, Todd M. > Cc: php-general@xxxxxxxxxxxxx > Subject: SV: Problems with images.. > > > > I've been staring myself blind, so now I don't get anywhere, please > > do > > > advice.. > > > > > > I have a web page printed with PHP, in a table I need to display > > images > > > that > > > are stored in a SQL DB. > > > Getting the images into variables isn't an issue at all, but how do > I > > > output > > > it? > > > This is what I want to accomplish: > > > > > > <tr><td>Current image:</td><td> - THE IMAGE HERE - </td></tr> > > > > > > Starting to pull my hair.. > > > > <tr><td>Current image:</td><td><img src="<?= $variableName ?>" > > /></td></tr> > > > > If you don't have the proper INI setting to allow for the short-hand > > <?= > > ?>, you can replace it with: > > > > <?php echo $variableName; ?> > > > > If this made you pull your hair out, then perhaps you should go back > > and > > get a fundamental understanding of HTML and PHP basics before trying > to > > combine the two. Just sayin'. > > > Thank you for your wonderful sarcasm Todd. But the solution you suggest > just > won't work, and as a programmer, you should be just about knowledgeable > enough to know that. > > However, I got a tip about something that WILL work, so I prefer to > listen > to that person instead. She said; > > <td> > <?php > ob_start(); > echo $info['image']; > $data = base64_encode(ob_get_contents()); > ob_end_clean(); > echo "<img src=\"data:image/jpeg;base64,$data\">"; > ?> > </td> I was, in fact, NOT being sarcastic. Perhaps if you had been more specific about "images in variables" (it looks like you're using BLOBs, I had guessed you were using filenames and storing the images on disk... which is another argument altogether), my answer (or sarcasm, in your eyes) would have been more direct to your question. As for my solution not working--for BLOBs, no. Of course not. My analogy of your question, however, is a bit like this: Q: "How do I turn on this light switch?" A: "You flip it to the 'on' position." ... Q: "No, I mean how do I route power from the solar panels on my roof to produce a current that will be affected by this lightswitch?" I don't see the reason for Base64 encoding anything, but I'm glad (also not sarcastic) that you got the answer to your question that you were looking for. I also hope that you learned to be more specific when you're requesting assistance, and not throwing someone's suggestions back in their face when they were just trying to lend you a hand with what they understood your question to be. Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php