note 32495 added to function.base64-encode

From: Date: Thu, 29 May 2003 02:21:37 +0000
Subject: note 32495 added to function.base64-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-49236@lists.php.net to get a copy of this message
if you want to insert the base64 encoded image in your html <img src> you need to write 'data:datatype;base64,encodeddata' . For example here's a way to embed an PNG image data: <? //get the base64 encoded image $handle = fopen($tempfile,'rb'); $file_content = fread($handle,filesize($tempfile)); fclose($handle); $encoded = chunk_split(base64_encode($file_content)); //then echo to browser as: echo '<img src="data:image/png;base64,'.$encoded.' ">'; ?> ---- Manual Page -- http://www.php.net/manual/en/function.base64-encode.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32495 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32495&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32495&report=yes

« previous php.notes (#49236) next »