source: trunk/expressoMail1_2/inc/show_thumbs.php @ 5316

Revision 5316, 1.1 KB checked in by cristiano, 12 years ago (diff)

Ticket #2423 - Trocar chamada da variável rootPath

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2/*
3 * Requieres
4 */
5 require_once '../../header.session.inc.php';
6 require_once dirname(__FILE__).'/class.attachment.inc.php';
7 //------------------------//
8
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//-------------------------------------//
17
18
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//------------------------------------------//
40?>
Note: See TracBrowser for help on using the repository browser.