source: sandbox/2.5.0-expresso1/expressoMail1_2/inc/show_thumbs.php @ 5509

Revision 5509, 1.8 KB checked in by gustavo, 12 years ago (diff)

Ticket #2488 - Adicionar cabecalho de licenca em arquivos que nao o possuem

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2                /***************************************************************************
3                * Expresso Livre                                                           *
4                * http://www.expressolivre.org                                             *
5                * --------------------------------------------                             *
6                *  This program is free software; you can redistribute it and/or modify it *
7                *  under the terms of the GNU General Public License as published by the   *
8                *  Free Software Foundation; either version 2 of the License, or (at your  *
9                *  option) any later version.                                              *
10                \**************************************************************************/
11               
12/*
13 * Requieres
14 */
15 require_once '../../header.session.inc.php';
16 require_once dirname(__FILE__).'/class.attachment.inc.php';
17 //------------------------//
18
19 /*
20  * Get variables
21  */
22$fileType = $_GET['file_type'];
23$msgFolder = $_GET['msg_folder'];
24$msgNumber = $_GET['msg_num'];
25$part = $_GET['msg_part'];
26//-------------------------------------//
27
28
29/*
30 * Main
31 */
32$attachmentObj = new attachment();
33$attachmentObj->setStructureFromMail($msgFolder, $msgNumber);
34$fileContent = $attachmentObj->getAttachment($part);
35$pic = @imagecreatefromstring($fileContent);
36if($pic !== FALSE)
37{
38    header("Content-Type: ".$fileType);
39    header("Content-Disposition: inline");
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    $theight =  $theight < 1 ? 1 : $theight;
45    $thumb = imagecreatetruecolor ($twidth, $theight);
46    imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb
47    imagejpeg($thumb,"",75); # Thumbnail as JPEG
48}
49//------------------------------------------//
50?>
Note: See TracBrowser for help on using the repository browser.