output a base64_encoded image
Posted: Thu Apr 06, 2006 7:40 am
I am reading a mixture of plain text and images. There are various types of each i.e. gif, jpeg, png...
I would like to display them all on the same page but once you set a header, you can't then set another one for a different content type. Is there an easy way round this?
At the moment I am sending $type and $file as GET to another script, but I think they're too long and my images are corrupted. Alternatively, I could check for images and
but I think I'll still have the same problem.
I would like to display them all on the same page but once you set a header, you can't then set another one for a different content type. Is there an easy way round this?
Code: Select all
loop going through different parts being read{
$type = "image/jpeg"; // or image/gif or image/png or text/plain
$file = "some ascii string";
header("Content-type: $type");
echo($file);
}Code: Select all
echo '<img src="see_the_file.php?type='.$type.'&file='.urlencode(base64_encode($file)).'" />