Posted by Jim Michaels on 01/15/06 09:33
actually, you don't need to do a base64_decode() on a blob if it wasn't
encoded that way. if it's real binary data, all you need is stripslashes().
that's faster.
"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:43c9a78a$0$30461$dbd4b001@news.euronet.nl...
> This might work a little better:
>
> <?php
>
> session_start();
>
> if (isset($_SESSION['img']) && isset($_GET['id'])) {
> if (isset($_SESSION['img'][$_GET['id']])) {
> header("Content-Type: image/jpeg");
> print base64_decode($_SESSION['img'][$_GET['id']]);
> exit;
> }
> }
>
> // Prepare some test data
> $binary = file_get_contents('103.jpg');
> $binary2 = file_get_contents('283.jpg');
> $array = array($binary, $binary2);
>
> $_SESSION['img'] = array();
> foreach ($array as $e) {
> $_SESSION['img'][] = base64_encode($e);
> }
>
> for ($i = 0, $m = count($_SESSION['img']); $i < $m; $i++) {
> print "<img width=100 src='{$_SERVER['PHP_SELF']}?id=$i' />";
> }
>
> ?>
>
> But also read Chung's advice...
>
>
> JW
>
[Back to original message]
|