[PHP] base64_decode an image, works on blank page, not on page where text is..

2004-08-09 Thread Josh Acecool M
If I try to base64_decode an image which was encoded with base64_encode on a
blank page, it works, if I try on a page with stuff already on it, it just
shows me the source code to the image...

Example: Run this code as a blank page, no spaces before or after the ?
then run it again with a space or a character..

Any ideas how to fix it?
Thanks.


?php
if (!function_exists(ac_call_base64_image)) {
function ac_call_base64_image ($Image) {
//require (./ACWB/ACWB_Base64_Images.php);
//$Image = $ACWB_B64I[$Image];
return base64_decode($Image);
}
}
// RedX Image...
$ACWB_B64I['ACWB'] =
R0lGODlhHAAeAKIAAP8AAP///8DAwICAgP///wAAACH5BAEAAAUALAAcAB4AAAO
COLrc7mGUSau9NuL  Np+5g9YXhSHbmuaXF81zsEMx0HQgELFmybeO6S89HA2Z2lSHxl
jsKaQDALDozipAUZZRabV6fNW43yAtvi15KDCoNcK1q7ERJhHv
krSWanNSPnWV+dgUxAoaHiIZpdxcEjo+QkHwqK3iUX5eVmZqbk  50efqFECQA7;
echo ac_call_base64_image ($ACWB_B64I['ACWB']);
?


PS: phpBB2 somehow got it to work, not sure how though :-/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] base64_decode an image, works on blank page, not on page where text is..

2004-08-09 Thread Justin Patrin
On Mon, 9 Aug 2004 14:23:22 -0700, Josh Acecool M
[EMAIL PROTECTED] wrote:
 If I try to base64_decode an image which was encoded with base64_encode on a
 blank page, it works, if I try on a page with stuff already on it, it just
 shows me the source code to the image...
 
 Example: Run this code as a blank page, no spaces before or after the ?
 then run it again with a space or a character..
 
 Any ideas how to fix it?
 Thanks.
 
 ?php
 if (!function_exists(ac_call_base64_image)) {
 function ac_call_base64_image ($Image) {
 //require (./ACWB/ACWB_Base64_Images.php);
 //$Image = $ACWB_B64I[$Image];
 return base64_decode($Image);
 }
 }
 // RedX Image...
 $ACWB_B64I['ACWB'] =
 R0lGODlhHAAeAKIAAP8AAP///8DAwICAgP///wAAACH5BAEAAAUALAAcAB4AAAO
 COLrc7mGUSau9NuL  Np+5g9YXhSHbmuaXF81zsEMx0HQgELFmybeO6S89HA2Z2lSHxl
 jsKaQDALDozipAUZZRabV6fNW43yAtvi15KDCoNcK1q7ERJhHv
 krSWanNSPnWV+dgUxAoaHiIZpdxcEjo+QkHwqK3iUX5eVmZqbk  50efqFECQA7;
 echo ac_call_base64_image ($ACWB_B64I['ACWB']);
 ?
 
 PS: phpBB2 somehow got it to work, not sure how though :-/
 

You can't display an image inline. At least, not quite like that. You
*can* use a special img tag with mozilla to display inline, but this
isn't very well supported. Use an img tag to link to another script
and have that script base64_decode the image and display it (with the
correct headers).

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php