Posted by Janwillem Borleffs on 01/15/06 03:38
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]
|