Location: PHPKode > projects > Myphpim > MyPhPim-01.05/makeimage.php3
<?php

//****************************************************************************************
//                Copyright (C) 2000 Koen de Boeve
//
//        This program is free software; you can redistribute it and/or
//        modify it under the terms of the GNU General Public License
//        as published by the Free Software Foundation; either version 2
//        of the License, or (at your option) any later version.
//
//        This program is distributed in the hope that it will be useful,
//        but WITHOUT ANY WARRANTY; without even the implied warranty of
//        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//        GNU General Public License for more details.
//
//        You should have received a copy of the GNU General Public License
//        along with this program; if not, write to the Free Software
//        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//
//        Version : MyPhPim-01.05
//        Author : Koen de Boeve
//        Contact: hide@address.com
//**************************************************************************************** 

include "conf/imap_conf.inc";
include "includes/imap_cl.inc";
include "includes/mysql_cl.inc";
include "includes/mcrypt_cl.inc";

session_start();

$db = new DB;
$userdata = $db->Fetch_login ( $user, $choosehost );
$login = $userdata[0];
$pass = $userdata[1];
$proto = $userdata[2];
$host = $userdata[3];
$port = $userdata[4];
if ( $part_no == 1 ) {
                        $part = $part_no;
                } else {
                        if ( strpos ( $part_no, "." ) ) {
                                $tmp = explode ( ".", $part_no );
                                $part = $tmp[1];
                        } 
                }


$imap2 = new ImapCl;
        $stream = $imap2->InitFolder ( $host, $port, $proto, $login, $pass, $folder );
        $text = imap_fetchbody ( $stream, $msgno, $part  );
        $image = imap_base64 ( $text );
        $str = strtoupper ( $subtype );
        switch ( $str ) {
                case "GIF":
                        Header ( "Content-type: image/gif" );
                        echo "$image";
                        break;;
                case "JPEG":
                        Header ( "Content-type: image/jpeg");
                        echo "$image";
                        break;;
        }
	$imap2->close ( $stream );

?>
Return current item: Myphpim