source: trunk/expressoMail1_2/inc/show_thumbs.php @ 1036

Revision 1036, 1.7 KB checked in by amuller, 15 years ago (diff)

Ticket #559 - Atualização de segurança

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