source: branches/2.2/expressoMail1_2/inc/show_img.php @ 3018

Revision 3018, 1.8 KB checked in by amuller, 14 years ago (diff)

Ticket #1135 - Aplicando alterações do branches 2.0 no branches 2.2

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2
3        require_once '../../header.session.inc.php';
4        header("Content-Type: image/jpeg");
5        if($_GET['msg_num'] && $_GET['msg_part'] && $_GET['msg_folder']) {
6                $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
7                $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
8                $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
9                $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
10        if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes')
11        {
12                $imap_options = '/tls/novalidate-cert';
13        }
14        else
15        {
16                $imap_options = '/notls/novalidate-cert';
17        }
18               
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               
24        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
25               
26                $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
27
28                header("Content-Disposition: inline");
29                $image = imap_base64($image_mail);
30                echo $image;           
31        }
32        else if($_SESSION['phpgw_info']['expressomail']['contact_photo']){     
33                $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo'];
34                               
35                if($data) {
36                       
37                        $photo = imagecreatefromstring($data[0]);
38                        if($photo){
39                                $width = imagesx($photo);
40                                $height = imagesy($photo);
41                                $twidth = 60;
42                                $theight = 80;
43                                $small_photo = imagecreatetruecolor ($twidth, $theight);
44                                imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
45                                imagejpeg($small_photo,'',100);
46                                unset($_SESSION['phpgw_info']['expressomail']['contact_photo']);
47                        }
48                }
49        }
50        else
51                readfile("./../../contactcenter/templates/default/images/photo_celepar.png");
52?>
Note: See TracBrowser for help on using the repository browser.