Ignore:
Timestamp:
05/16/11 11:44:10 (13 years ago)
Author:
airton
Message:

Ticket #1887 - Redefinicao do parser de email - Todas as adequacoes feitas no parser.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/expressoMail1_2/inc/show_thumbs.php

    r3018 r4416  
    11<?php 
     2/* 
     3 * Requieres 
     4 */ 
     5 require_once '../../header.session.inc.php'; 
     6 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 
     7 //------------------------// 
    28 
    3         require_once '../../header.session.inc.php';  
    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         } 
     9 /* 
     10  * Get variables 
     11  */ 
     12$fileType = $_GET['file_type']; 
     13$msgFolder = $_GET['msg_folder']; 
     14$msgNumber = $_GET['msg_num']; 
     15$part = $_GET['msg_part']; 
     16//-------------------------------------// 
    1617 
    17         $file_type = $_GET['file_type']; 
    18         $msg_num = $_GET['msg_num']; 
    19         $msg_part = $_GET['msg_part']; 
    20         $msg_folder = $_GET['msg_folder']; 
    21         $msg_folder = mb_convert_encoding($msg_folder,"UTF7-IMAP", mb_detect_encoding($msg_folder, "UTF-8, ISO-8859-1", true)); 
    22         $mb = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$msg_folder, $username, $password); 
    2318 
    24         $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID); 
    25         $image = imap_base64($image_mail); 
    26         $pic = @imagecreatefromstring ($image); 
    27         if($pic !== FALSE) {  
    28                 header("Content-Type: ".$file_type);  
    29                 header("Content-Disposition: inline"); 
    30                 $width = imagesx($pic); 
    31                 $height = imagesy($pic); 
    32                 $twidth = 160; # width of the thumb 160 pixel 
    33                 $theight = $twidth * $height / $width; # calculate height 
    34                 $theight =  $theight < 1 ? 1 : $theight;  
    35                 $thumb = imagecreatetruecolor ($twidth, $theight); 
    36                 imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb 
    37                 imagejpeg($thumb,"",75); # Thumbnail as JPEG 
    38         } 
     19/* 
     20 * Main 
     21 */ 
     22$attachmentObj = new attachment(); 
     23$attachmentObj->setStructureFromMail($msgFolder, $msgNumber); 
     24$fileContent = $attachmentObj->getAttachment($part); 
     25$pic = @imagecreatefromstring($fileContent); 
     26if($pic !== FALSE) 
     27{ 
     28    header("Content-Type: ".$fileType); 
     29    header("Content-Disposition: inline"); 
     30    $width = imagesx($pic); 
     31    $height = imagesy($pic); 
     32    $twidth = 160; # width of the thumb 160 pixel 
     33    $theight = $twidth * $height / $width; # calculate height 
     34    $theight =  $theight < 1 ? 1 : $theight; 
     35    $thumb = imagecreatetruecolor ($twidth, $theight); 
     36    imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb 
     37    imagejpeg($thumb,"",75); # Thumbnail as JPEG 
     38} 
     39//------------------------------------------// 
    3940?> 
Note: See TracChangeset for help on using the changeset viewer.