note 93393 added to book.image

From: Date: Mon, 07 Sep 2009 22:09:13 +0000
Subject: note 93393 added to book.image
Groups: php.notes 
Request: Send a blank email to php-notes+get-160284@lists.php.net to get a copy of this message
Building on Ashley's example, here's an example of some code that grabs an existing image file and outputs an html img tag with the contents. I found it useful because I needed to not broadcast the filenames. <?php $file = 'images/01.png'; $image = imagecreatefrompng($file); imagealphablending($image, false); imagesavealpha($image, true); // start buffering ob_start(); imagepng($image); $contents = ob_get_contents(); ob_end_clean(); echo "<img src='data:image/png;base64,".base64_encode($contents)."' />"; imagedestroy($image); ?> ---- Server IP: 209.41.74.194 Probable Submitter: 76.22.128.158 ---- Manual Page -- http://www.php.net/manual/en/book.image.php Edit -- https://master.php.net/note/edit/93393 Del: integrated -- https://master.php.net/note/delete/93393/integrated Del: useless -- https://master.php.net/note/delete/93393/useless Del: bad code -- https://master.php.net/note/delete/93393/bad+code Del: spam -- https://master.php.net/note/delete/93393/spam Del: non-english -- https://master.php.net/note/delete/93393/non-english Del: in docs -- https://master.php.net/note/delete/93393/in+docs Del: other reasons-- https://master.php.net/note/delete/93393 Reject -- https://master.php.net/note/reject/93393 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160284) next »