source: sandbox/expressoMail1_2/corretor_ortografico/inc/show_thumbs.php @ 2053

Revision 2053, 1.5 KB checked in by niltonneto, 14 years ago (diff)

Ticket #920 - Correção para substituir header.inc por header.session.inc.

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