source: companies/celepar/expressoMail1_2/inc/show_img.php @ 763

Revision 763, 1.8 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

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