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

Revision 2360, 2.3 KB checked in by amuller, 14 years ago (diff)

Ticket #1008 - Adicionando informações sobre licenças

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2
3/***************************************************************************
4        * Expresso Livre                                                           *
5        * http://www.expressolivre.org                                             *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13        require_once '../../header.session.inc.php';
14
15        $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
16        $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
17        $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
18        $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
19        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
20        {
21                $imap_options = '/tls/novalidate-cert';
22        }
23        else
24        {
25                $imap_options = '/notls/novalidate-cert';
26        }
27
28        $file_type = $_GET['file_type'];
29        $msg_num = $_GET['msg_num'];
30        $msg_part = $_GET['msg_part'];
31        $msg_folder = $_GET['msg_folder'];
32        $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true));
33        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
34
35        $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
36        $image = imap_base64($image_mail);
37        $image = imagecreatefromstring ($image);
38       
39        header("Content-Type: ".$file_type);
40        header("Content-Disposition: inline");
41 
42        $pic = $image;
43    if ($pic) {
44        $width = imagesx($pic);
45        $height = imagesy($pic);
46        $twidth = 160; # width of the thumb 160 pixel
47        $theight = $twidth * $height / $width; # calculate height
48        $thumb = imagecreatetruecolor ($twidth, $theight);
49                imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb
50                imagejpeg($thumb,"",75); # Thumbnail as JPEG
51    }
52?>
Note: See TracBrowser for help on using the repository browser.