Jump to content

encoding images


sford999

Recommended Posts

To reverse it just:

image.php:
[code]<?php
$string = "bla bla encoded image bla bla";
header("Content-type: ..."); // write the mime-type instead of the dots
echo base64_decode($string);
?>[/code]

other_file.html:
[code]
...
<img src='image.php' alt='image' />
...[/code]

Or you may do it like this if you want it in one file:

some_file.php: [code]<?php
$string = "bla bla encoded image bla bla";
if(isset($_GET['image']))
{
header("Content-type: ..."); // write the mime-type instead of the dots
echo base64_decode($string);
die();
}

echo "<img src='some_file.php?image' alt='image' />";
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/20617-encoding-images/#findComment-91065
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.