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

Revision 27, 1.6 KB checked in by niltonneto, 17 years ago (diff)

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:executable set to *
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               
21        $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password);
22               
23                $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
24
25                header("Content-Disposition: inline");
26                $image = imap_base64($image_mail);
27                echo $image;           
28        }
29        else if($_SESSION['phpgw_info']['expressomail']['contact_photo']){     
30                $data  = $_SESSION['phpgw_info']['expressomail']['contact_photo'];
31                               
32                if($data) {
33                       
34                        $photo = imagecreatefromstring($data[0]);
35                        if($photo){
36                                $width = imagesx($photo);
37                                $height = imagesy($photo);
38                                $twidth = 60;
39                                $theight = 80;
40                                $small_photo = imagecreatetruecolor ($twidth, $theight);
41                                imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height);
42                                imagejpeg($small_photo,'',100);
43                                unset($_SESSION['phpgw_info']['expressomail']['contact_photo']);
44                        }
45                }
46        }
47        else
48                readfile("./../../contactcenter/templates/default/images/photo_celepar.png");
49?>
Note: See TracBrowser for help on using the repository browser.