Ignore:
Timestamp:
07/08/10 17:52:20 (14 years ago)
Author:
amuller
Message:

Ticket #1135 - Aplicando alterações do branches 2.0 no branches 2.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/show_thumbs.php

    r1040 r3018  
    11<?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'; 
    102 
     3        require_once '../../header.session.inc.php';  
    114        $username = $_SESSION['phpgw_info']['expressomail']['user']['userid']; 
    125        $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd']; 
     
    3124        $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID); 
    3225        $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); 
     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); 
    4536                imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb 
    4637                imagejpeg($thumb,"",75); # Thumbnail as JPEG 
    47     } 
     38        } 
    4839?> 
Note: See TracChangeset for help on using the changeset viewer.