source: companies/celepar/expressoMail1_2/inc/show_thumbs.php @ 763

Revision 763, 1.5 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1<?php
2        $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
3        $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
4        $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
5        $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
6        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
7        {
8                $imap_options = '/tls/novalidate-cert';
9        }
10        else
11        {
12                $imap_options = '/notls/novalidate-cert';
13        }
14
15        $file_type = $_GET['file_type'];
16        $msg_num = $_GET['msg_num'];
17        $msg_part = $_GET['msg_part'];
18        $msg_folder = $_GET['msg_folder'];
19        $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true));
20        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
21
22        $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
23        $image = imap_base64($image_mail);
24        $image = imagecreatefromstring ($image);
25       
26        header("Content-Type: ".$file_type);
27        header("Content-Disposition: inline");
28 
29        $pic = $image;
30    if ($pic) {
31        $width = imagesx($pic);
32        $height = imagesy($pic);
33        $twidth = 160; # width of the thumb 160 pixel
34        $theight = $twidth * $height / $width; # calculate height
35        $thumb = imagecreatetruecolor ($twidth, $theight);
36                imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb
37                imagejpeg($thumb,"",75); # Thumbnail as JPEG
38    }
39?>
Note: See TracBrowser for help on using the repository browser.