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

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