Re: Check RAW data
| From: | Jason Norwood-Young | Date: | Sun, 20 Apr 2008 14:20:44 +0000 |
| Subject: | Re: Check RAW data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273323@lists.php.net to get a copy of this message | ||
On Sun, 2008-04-20 at 15:52 +0200, rb wrote:
> I'm getting from an external source a PNG image in raw format (encoded in
> base64).
>
> And with this code I'll echo on the screen.
>
> ------
> $img=base64_decode($_POST['img']);
>
> header("Content-type: image/png");
> echo $img;
> ------
A quick way would be to try and make an image with the GD library.
Something like:
if (imagecreatefromstring($img)) {
header("Content-type:image/png");
echo $img;
}