1 | <?php |
---|
2 | /***************************************************************************\ |
---|
3 | * Expresso - Expresso Messenger * |
---|
4 | * - Alexandre Correia / Rodrigo Souza * |
---|
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 | class webService |
---|
13 | { |
---|
14 | public final function getPhotoSession($pUid, $pOu) |
---|
15 | { |
---|
16 | $uid = $pUid; |
---|
17 | if( strpos($pUid, "@") ) |
---|
18 | $uid = substr($pUid, 0, strpos($pUid, "@")); |
---|
19 | |
---|
20 | require_once("../../header.session.inc.php"); |
---|
21 | |
---|
22 | if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]) ) |
---|
23 | { |
---|
24 | $photo = imagecreatefromstring($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]); |
---|
25 | |
---|
26 | header("Content-Type: image/jpeg"); |
---|
27 | $width = imagesx($photo); |
---|
28 | $height = imagesy($photo); |
---|
29 | $twidth = 60; |
---|
30 | $theight = 80; |
---|
31 | $small_photo = imagecreatetruecolor ($twidth, $theight); |
---|
32 | imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); |
---|
33 | imagejpeg($small_photo,'',100); |
---|
34 | |
---|
35 | unset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]); |
---|
36 | |
---|
37 | return; |
---|
38 | } |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | // Php - fotos pelo php; |
---|
43 | if(trim($_REQUEST['phpPhoto']) != "") |
---|
44 | { |
---|
45 | $obj = new webservice(); |
---|
46 | $ou = $_REQUEST['phpOu']; |
---|
47 | $jid = $_REQUEST['phpPhoto']; |
---|
48 | |
---|
49 | $obj->getPhotoSession($jid, $ou); |
---|
50 | } |
---|
51 | |
---|
52 | ?> |
---|