Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.