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

Revision 2360, 2.6 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        header("Content-Type: image/jpeg");
16        if($_GET['msg_num'] && $_GET['msg_part'] && $_GET['msg_folder']) {
17                $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
18                $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
19                $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
20                $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
21        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
22        {
23                $imap_options = '/tls/novalidate-cert';
24        }
25        else
26        {
27                $imap_options = '/notls/novalidate-cert';
28        }
29               
30                $msg_num = $_GET['msg_num'];
31                $msg_part = $_GET['msg_part'];
32                $msg_folder = $_GET['msg_folder'];
33                $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true));
34               
35        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
36               
37                $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
38
39                header("Content-Disposition: inline");
40                $image = imap_base64($image_mail);
41                echo $image;           
42        }
43        else if($_SESSION['phpgw_info']['expressomail']['contact_photo']){     
44                $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo'];
45                               
46                if($data) {
47                       
48                        $photo = imagecreatefromstring($data[0]);
49                        if($photo){
50                                $width = imagesx($photo);
51                                $height = imagesy($photo);
52                                $twidth = 60;
53                                $theight = 80;
54                                $small_photo = imagecreatetruecolor ($twidth, $theight);
55                                imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
56                                imagejpeg($small_photo,'',100);
57                                unset($_SESSION['phpgw_info']['expressomail']['contact_photo']);
58                        }
59                }
60        }
61        else
62                readfile("./../../contactcenter/templates/default/images/photo_celepar.png");
63?>
Note: See TracBrowser for help on using the repository browser.