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

Revision 3163, 2.0 KB checked in by amuller, 14 years ago (diff)

Ticket #1163 - Mudando data de expiração das fotos

  • 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{
33                $expires = 60*60*24*30; /* 30 days */
34                header("Cache-Control: maxage=".$expires);
35                header("Pragma: public");
36                header("Expires: ".gmdate('D, d M Y H:i:s', time()+$expires));
37                if($_SESSION['phpgw_info']['expressomail']['contact_photo']){   
38                        $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo'];
39
40                        if($data) {
41
42                                $photo = imagecreatefromstring($data[0]);
43                                if($photo){
44                                        $width = imagesx($photo);
45                                        $height = imagesy($photo);
46                                        $twidth = 60;
47                                        $theight = 80;
48                                        $small_photo = imagecreatetruecolor ($twidth, $theight);
49                                        imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
50                                        imagejpeg($small_photo,'',100);
51                                        unset($_SESSION['phpgw_info']['expressomail']['contact_photo']);
52                                }
53                        }
54                }
55                else
56                        readfile("./../../contactcenter/templates/default/images/photo_celepar.png");
57        }
58?>
Note: See TracBrowser for help on using the repository browser.