Ignore:
Timestamp:
04/13/10 17:48:28 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado o status de mensagem e a busca da foto no ldap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/inc/WebService.php

    r2471 r2511  
    1212class WebService 
    1313{ 
     14        function __construct() 
     15        { 
     16                require_once("../../header.session.inc.php");            
     17        } 
     18 
     19        public final function getPhoto($pUid) 
     20        { 
     21                require_once("class.LdapIM.inc.php"); 
     22                 
     23                $ldap = new LdapIM(); 
     24 
     25                $uid = $pUid; 
     26                if( strpos($pUid, "/") ) 
     27                        $uid = substr($pUid, 0, strpos($pUid, "/")); 
     28                 
     29                $photo = $ldap->getPhotoUser($uid, true); 
     30                 
     31                if ( !$photo ) 
     32                        $photo = $ldap->getPhotoUser($uid, false); 
     33         
     34                if( $photo ) 
     35                        $photo = imagecreatefromstring($photo); 
     36                else 
     37                        $photo = imagecreatefrompng("../templates/default/images/photo.png"); 
     38 
     39                header("Content-Type: image/jpeg"); 
     40                $width = imagesx($photo); 
     41                $height = imagesy($photo); 
     42                $twidth = 60; 
     43                $theight = 80; 
     44                $small_photo = imagecreatetruecolor ($twidth, $theight); 
     45                imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 
     46                imagejpeg($small_photo,'',100); 
     47 
     48                return; 
     49        } 
     50         
    1451        public final function getPhotoSession($pUid, $pOu) 
    1552        { 
     
    1754                if( strpos($pUid, "@") ) 
    1855                        $uid = substr($pUid, 0, strpos($pUid, "@")); 
    19                  
    20                 require_once("../../header.session.inc.php"); 
    2156                 
    2257                if( isset($_SESSION['phpgw_info']['jabberit_messenger']['photo'][$pOu][$uid]) ) 
     
    4075} 
    4176 
    42 // Php - fotos pelo php; 
    43 if(trim($_REQUEST['phpPhoto']) != "") 
     77// Photo in Session 
     78if(trim($_REQUEST['photo_session']) != "") 
    4479{ 
    4580        $obj    = new WebService(); 
    46         $ou             = $_REQUEST['phpOu']; 
    47         $jid    = $_REQUEST['phpPhoto']; 
     81        $ou             = $_REQUEST['ou']; 
     82        $jid    = $_REQUEST['photo_session']; 
    4883         
    4984        $obj->getPhotoSession($jid, $ou); 
    5085} 
    5186 
     87// Photo Ldap  
     88if(trim($_REQUEST['photo_ldap'])) 
     89{ 
     90        $obj    = new WebService(); 
     91        $jid    = $_REQUEST['photo_ldap']; 
     92        $obj->getPhoto($jid); 
     93} 
    5294 
    5395?> 
Note: See TracChangeset for help on using the changeset viewer.