Location: PHPKode > projects > NOCC > get_img.php
<?php
/**
 * File for viewing the images
 *
 * Copyright 2001 Nicolas Chalanset <hide@address.com>
 * Copyright 2001 Olivier Cahagne <hide@address.com>
 *
 * This file is part of NOCC. NOCC is free software under the terms of the
 * GNU General Public License. You should have received a copy of the license
 * along with NOCC.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    NOCC
 * @license    http://www.gnu.org/licenses/ GNU General Public License
 * @version    SVN: $Id: get_img.php 2186 2010-04-27 19:00:42Z gerundt $
 */

require_once './common.php';

$ev = "";
$pop = new nocc_imap($ev);
if (NoccException::isException($ev)) {
    require './html/header.php';
    require './html/error.php';
    require './html/footer.php';
    return;
}

$mail = $_REQUEST['mail'];
$num = $_REQUEST['num'];
$transfer = $_REQUEST['transfer'];
$mime = $_REQUEST['mime'];

$img = $pop->fetchbody($mail, $num, $ev);
if (NoccException::isException($ev)) {
    require './html/header.php';
    require './html/error.php';
    require './html/footer.php';
    return;
}

$img = nocc_imap::decode($img, $transfer);
$pop->close();

header('Content-type: image/'.$mime);
echo $img;
?>
Return current item: NOCC