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

Revision 1040, 2.0 KB checked in by amuller, 15 years ago (diff)

Ticket #559 - Atualização de download de arquivos e sessão

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