[2] | 1 | <?php |
---|
[1040] | 2 | |
---|
[2360] | 3 | /*************************************************************************** |
---|
| 4 | * Expresso Livre * |
---|
| 5 | * http://www.expressolivre.org * |
---|
| 6 | * -------------------------------------------- * |
---|
| 7 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 8 | * under the terms of the GNU General Public License as published by the * |
---|
| 9 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 10 | * option) any later version. * |
---|
| 11 | \**************************************************************************/ |
---|
| 12 | |
---|
[2053] | 13 | require_once '../../header.session.inc.php'; |
---|
| 14 | |
---|
[2] | 15 | $username = $_SESSION['phpgw_info']['expressomail']['user']['userid']; |
---|
| 16 | $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd']; |
---|
| 17 | $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer']; |
---|
| 18 | $imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort']; |
---|
[27] | 19 | if ($_SESSION['phpgw_info']['expressomail']['email_server']['imapTLSEncryption'] == 'yes') |
---|
| 20 | { |
---|
| 21 | $imap_options = '/tls/novalidate-cert'; |
---|
| 22 | } |
---|
| 23 | else |
---|
| 24 | { |
---|
| 25 | $imap_options = '/notls/novalidate-cert'; |
---|
| 26 | } |
---|
[2] | 27 | |
---|
| 28 | $file_type = $_GET['file_type']; |
---|
| 29 | $msg_num = $_GET['msg_num']; |
---|
| 30 | $msg_part = $_GET['msg_part']; |
---|
| 31 | $msg_folder = $_GET['msg_folder']; |
---|
[178] | 32 | $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true)); |
---|
[27] | 33 | $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password); |
---|
[178] | 34 | |
---|
[2] | 35 | $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID); |
---|
| 36 | $image = imap_base64($image_mail); |
---|
[2651] | 37 | $pic = @imagecreatefromstring ($image); |
---|
[2] | 38 | |
---|
[2651] | 39 | if($pic !== FALSE) { |
---|
| 40 | header("Content-Type: ".$file_type); |
---|
| 41 | header("Content-Disposition: inline"); |
---|
[2] | 42 | $width = imagesx($pic); |
---|
| 43 | $height = imagesy($pic); |
---|
| 44 | $twidth = 160; # width of the thumb 160 pixel |
---|
| 45 | $theight = $twidth * $height / $width; # calculate height |
---|
| 46 | $thumb = imagecreatetruecolor ($twidth, $theight); |
---|
| 47 | imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb |
---|
| 48 | imagejpeg($thumb,"",75); # Thumbnail as JPEG |
---|
| 49 | } |
---|
[1037] | 50 | ?> |
---|