Re: SV: [PHP] Problems with images..
On Mon, Nov 3, 2008 at 2:46 PM, Ashley Sheridan [EMAIL PROTECTED]wrote: On Mon, 2008-11-03 at 15:56 +0100, Anders Norrbring wrote: Anders Norrbring wrote: 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: trtdCurrent image:/tdtd - THE IMAGE HERE - /td/tr Starting to pull my hair.. Anders. img src=fetchimg?id=n/ fetchimg.php: header('Content-Type: image/jpeg'); $img=fetch from db; print $img; True Per, but I would prefer one single file in this case.. Anders. You can have the image script as part of the same PHP file, by checking to see if it is being called for an image rather than a normal page, but it just makes things more convoluted. Also, the base64 method will not work in IE. I had a similar problem at work that could only be solved by using a separate script to output the image. It can't be streamed inline in a consistent manner. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I too prefer to have the image called from a separate page. img src='getimage.php?id=12345'/ That way if the images are of differeing types (tiff/png/jpg/etc) I can locate all the handling code in the getimage.php file and its becomes the one place to handle this kind of stuff -- Bastien Cat, the other other white meat
SV: [PHP] 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: trtdCurrent image:/tdtd - THE IMAGE HERE - /td/tr Starting to pull my hair.. trtdCurrent image:/tdtdimg 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Problems with images..
Anders Norrbring wrote: 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: trtdCurrent image:/tdtd - THE IMAGE HERE - /td/tr Starting to pull my hair.. Anders. img src=fetchimg?id=n/ fetchimg.php: header('Content-Type: image/jpeg'); $img=fetch from db; print $img; True Per, but I would prefer one single file in this case.. Anders. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Problems with images..
On Mon, 2008-11-03 at 15:56 +0100, Anders Norrbring wrote: Anders Norrbring wrote: 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: trtdCurrent image:/tdtd - THE IMAGE HERE - /td/tr Starting to pull my hair.. Anders. img src=fetchimg?id=n/ fetchimg.php: header('Content-Type: image/jpeg'); $img=fetch from db; print $img; True Per, but I would prefer one single file in this case.. Anders. You can have the image script as part of the same PHP file, by checking to see if it is being called for an image rather than a normal page, but it just makes things more convoluted. Also, the base64 method will not work in IE. I had a similar problem at work that could only be solved by using a separate script to output the image. It can't be streamed inline in a consistent manner. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php