Exemplo n.º 1
0
 public function ajaxUpdateThumbnail($type, $id, $sourceX, $sourceY, $width, $height)
 {
     CPhotosHelper::updateAvatar($type, $id, $sourceX, $sourceY, $width, $height);
     switch ($type) {
         case 'profile':
             $url = CRoute::_('index.php?option=com_community&view=' . $type . '&userid=' . $id);
             break;
         case 'group':
             $url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $id);
             break;
         case 'event':
             $url = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $id);
             break;
     }
     $json = array('success' => true, 'redirUrl' => $url);
     die(json_encode($json));
 }
Exemplo n.º 2
0
 /**
  * Resize user's thumbnail from the source image
  *
  * @param Object $imgObj
  * @param String $src
  *
  */
 public function ajaxUpdateThumbnail($sourceX, $sourceY, $width, $height, $hideSave = false)
 {
     $filter = JFilterInput::getInstance();
     $sourceX = $filter->clean($sourceX, 'float');
     $sourceY = $filter->clean($sourceY, 'float');
     $width = $filter->clean($width, 'float');
     $height = $filter->clean($height, 'float');
     $hideSave = $filter->clean($hideSave, 'bool');
     // Fetch the thumbnail remotely. This is necessary since the user
     // profile picture might not be stored locally
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     if ($my->id && $my->_avatar != '') {
         CPhotosHelper::updateAvatar('profile', $my->id, $sourceX, $sourceY, $width, $height);
         $objResponse->addScriptCall('refreshThumbnail');
     } else {
         return $this->ajaxBlockUnregister();
     }
     return $objResponse->sendResponse();
 }