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

Revision 2, 1.2 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        $username = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
3        $password = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
4        $imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
5        $imap_port      = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
6
7        $file_type = $_GET['file_type'];
8        $msg_num = $_GET['msg_num'];
9        $msg_part = $_GET['msg_part'];
10        $msg_folder = $_GET['msg_folder'];
11       
12        $mb = imap_open("{".$imap_server.":".$imap_port."}".$msg_folder, $username, $password);
13       
14        $image_mail = imap_fetchbody($mb, $msg_num, $msg_part, FT_UID);
15        $image = imap_base64($image_mail);
16        $image = imagecreatefromstring ($image);
17       
18        header("Content-Type: ".$file_type);
19        header("Content-Disposition: inline");
20 
21        $pic = $image;
22    if ($pic) {
23        $width = imagesx($pic);
24        $height = imagesy($pic);
25        $twidth = 160; # width of the thumb 160 pixel
26        $theight = $twidth * $height / $width; # calculate height
27        $thumb = imagecreatetruecolor ($twidth, $theight);
28                imagecopyresized($thumb, $pic, 0, 0, 0, 0,$twidth, $theight, $width, $height); # resize image into thumb
29                imagejpeg($thumb,"",75); # Thumbnail as JPEG
30    }
31?>
Note: See TracBrowser for help on using the repository browser.