mmc215 Posted August 15, 2011 Share Posted August 15, 2011 Hey folks, I am using a PHP product to produce shipping labels directly from a major carrier. The php script returns an array of info with the image data sent in Base64 format. I'm told that I can display this as an image (GIF) in the broswer with this format but I'm pretty much lost (don't laugh, I'm only an html/css simpleton): <img src="data:image/gif;base64,iVBORw0KGgoAAAANS..." /> Here's the resulting data I need to turn into a printable GIF image: Array ( [charges] => 6.89 [trk_main] => 1Z5977460394839629 [pkgs] => Array ( [0] => Array ( [pkg_trk_num] => 1Z5977460394839629 [label_fmt] => ZPL [label_img] => Cl5YQV5MUk5eTU5ZXk1GTixOXkxIMTUsMTBPSV5QVzg... Any help would be so awesomely appreciated! mmc Quote Link to comment https://forums.phpfreaks.com/topic/244841-using-base64_decode-to-display-a-gif-image-from-an-array/ Share on other sites More sharing options...
AbraCadaver Posted August 15, 2011 Share Posted August 15, 2011 Not tested, but maybe something like this: display.php <?php header('Content-Type: image/gif'); echo base64_decode($array['pkgs'][0]['label_img']); ?> Then wherever you want to display it: <img src="display.php" /> Would need to see more code or have an explanation of how you retrieve this data. Quote Link to comment https://forums.phpfreaks.com/topic/244841-using-base64_decode-to-display-a-gif-image-from-an-array/#findComment-1257774 Share on other sites More sharing options...
xyph Posted August 15, 2011 Share Posted August 15, 2011 This may help http://www.websiteoptimization.com/speed/tweak/inline-images/ Quote Link to comment https://forums.phpfreaks.com/topic/244841-using-base64_decode-to-display-a-gif-image-from-an-array/#findComment-1257785 Share on other sites More sharing options...
mmc215 Posted August 15, 2011 Author Share Posted August 15, 2011 Thanks Abra I just sent you a PM with some more details. Quote Link to comment https://forums.phpfreaks.com/topic/244841-using-base64_decode-to-display-a-gif-image-from-an-array/#findComment-1257814 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.