1 | <?php |
---|
2 | if(!isset($GLOBALS['phpgw_info'])){ |
---|
3 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
4 | 'currentapp' => 'expressoMail1_2', |
---|
5 | 'nonavbar' => true, |
---|
6 | 'noheader' => true |
---|
7 | ); |
---|
8 | } |
---|
9 | require_once '../../header.inc.php'; |
---|
10 | |
---|
11 | $username = $_SESSION['phpgw_info']['expressomail']['user']['userid']; |
---|
12 | $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd']; |
---|
13 | $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer']; |
---|
14 | $imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort']; |
---|
15 | if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') |
---|
16 | { |
---|
17 | $imap_options = '/tls/novalidate-cert'; |
---|
18 | } |
---|
19 | else |
---|
20 | { |
---|
21 | $imap_options = '/notls/novalidate-cert'; |
---|
22 | } |
---|
23 | |
---|
24 | $file_type = $_GET['file_type']; |
---|
25 | $msg_num = $_GET['msg_num']; |
---|
26 | $msg_part = $_GET['msg_part']; |
---|
27 | $msg_folder = $_GET['msg_folder']; |
---|
28 | $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true)); |
---|
29 | $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password); |
---|
30 | |
---|
31 | $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID); |
---|
32 | $image = imap_base64($image_mail); |
---|
33 | $image = imagecreatefromstring ($image); |
---|
34 | |
---|
35 | header("Content-Type: ".$file_type); |
---|
36 | header("Content-Disposition: inline"); |
---|
37 | |
---|
38 | $pic = $image; |
---|
39 | if ($pic) { |
---|
40 | $width = imagesx($pic); |
---|
41 | $height = imagesy($pic); |
---|
42 | $twidth = 160; # width of the thumb 160 pixel |
---|
43 | $theight = $twidth * $height / $width; # calculate height |
---|
44 | $thumb = imagecreatetruecolor ($twidth, $theight); |
---|
45 | imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb |
---|
46 | imagejpeg($thumb,"",75); # Thumbnail as JPEG |
---|
47 | } |
---|
48 | ?> |
---|