Jump to content

image base64 decode


phpsycho

Recommended Posts

I have some code that it supposed to pull the image code in a attachment and the decode it so it can be viewed.

<?php
include ('includes/conn.php');

$id = $_GET['id'];
$num = $_GET['num'];
$mime = strtolower($_GET['mime']);
$transfer = $_GET['transfer'];

header("Content-type: image/$mime");

$servr = "imap.**.com:143/novalidate-cert/tls";
$user = "adam@**";
$passwd = "**";

$pop = imap_open('{'.$servr.'}', $user, stripslashes($passwd));
$img = imap_fetchbody($pop, $id, $num);
imap_close($pop);
if ($transfer == 'BASE64'){
$img = base64_decode($img);
}else if ($transfer == 'QUOTED-PRINTABLE'){
$img = imap_qprint($img);
}

echo $img;
?>

 

All I see is a blank page when I run this. I commented out the header() so I can see the code just to check if its showing something or not. It does. That code should display the image shouldn't it?

I checked the email message on thunderbird and the image is viewable there. it says its base64 too.

Is there something I am missing in this code?

 

I posted once before about this problem, hope its not a problem to repost this; hadn't got any help on it yet. I'm just in a time crunch so trying to get it finished quick.

Thanks guys.

Link to comment
https://forums.phpfreaks.com/topic/243635-image-base64-decode/
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.