Пример #1
0
 /**
  * Takes a photo and builds it nicely.
  * @param string $fileLocation
  * @param int $memberId
  * @param bool	$skipDir	Don't add profile directory
  */
 public function buildSizedPhotos($fileLocation, $memberId, $skipDir = false)
 {
     $memberData = IPSMember::load($memberId);
     $t_height = $this->settings['member_photo_crop'] ? $this->settings['member_photo_crop'] : 100;
     $t_width = $this->settings['member_photo_crop'] ? $this->settings['member_photo_crop'] : 100;
     $p_max = $memberData['photoMaxKb'];
     $p_width = $memberData['photoMaxWidth'];
     $p_height = $memberData['photoMaxHeight'];
     $ext = IPSText::getFileExtension($fileLocation);
     $needResize = false;
     if (!$memberId) {
         return array('status' => 'cannot_find_member');
     }
     if (IN_ACP) {
         $memberData['photoMaxKb'] = $this->memberData['photoMaxKb'];
         $memberData['photoMaxWidth'] = $this->memberData['photoMaxWidth'];
         $memberData['photoMaxHeight'] = $this->memberData['photoMaxHeight'];
     }
     /* Fix up upload directory */
     $paths = $this->_getProfileUploadPaths($skipDir);
     $storagePath = $this->_getProfileUploadPaths();
     $upload_path = $paths['path'];
     $upload_dir = $paths['dir'];
     /* Does image even exist?  If not, just return (can't rebuild a file that doesn't exist). */
     if (!file_exists($upload_path . '/' . $fileLocation)) {
         return array('final_location' => '', 'final_width' => 0, 'final_height' => 0, 't_final_location' => '', 't_file_name' => '', 't_final_width' => 0, 't_final_height' => 0, 'status' => 'missing_image');
     }
     /* Get kernel library */
     require_once IPS_KERNEL_PATH . 'classImage.php';
     /*noLibHook*/
     /* Fetch image dims */
     $imageDimensions = @getimagesize($upload_path . '/' . $fileLocation);
     /* Do we need to resize? */
     if ($imageDimensions[0] > $t_width or $imageDimensions[1] > $t_height) {
         $needResize = true;
     } else {
         if ($ext == 'gif' && !$this->settings['member_photo_gif_animate']) {
             /* Resize even if smaller to prevent animation */
             $needResize = true;
         }
     }
     /* Overide if we have a GIF and want to keep it animating */
     if ($ext == 'gif' && $this->settings['member_photo_gif_animate']) {
         $needResize = false;
     }
     /** SQUARE THUMBS **/
     if ($needResize) {
         $image = ips_kernel_image::bootstrap('gd');
         $image->init(array('image_path' => $upload_path, 'image_file' => $fileLocation));
         /* If we're uploading a GIF then resize to stop animations */
         if ($ext == 'gif' && !$this->settings['member_photo_gif_animate']) {
             $image->force_resize = true;
         }
         $return = $image->croppedResize($t_width, $t_height);
         $image->writeImage($storagePath['path'] . '/' . 'photo-thumb-' . $memberId . '.' . $ext);
         $t_im['img_width'] = $return['newWidth'];
         $t_im['img_height'] = $return['newHeight'];
         $t_im['img_location'] = count($return) ? $storagePath['dir'] . 'photo-thumb-' . $memberId . '.' . $ext : $upload_dir . $fileLocation;
     } else {
         $_data = IPSLib::scaleImage(array('max_height' => $t_height, 'max_width' => $t_width, 'cur_width' => $imageDimensions[0], 'cur_height' => $imageDimensions[1]));
         $t_im['img_width'] = $_data['img_width'];
         $t_im['img_height'] = $_data['img_height'];
         $t_im['img_location'] = $upload_dir . $fileLocation;
     }
     /** MAIN PHOTO **/
     if ($imageDimensions[0] > $p_width or $imageDimensions[1] > $p_height) {
         $image = ips_kernel_image::bootstrap('gd');
         $image->init(array('image_path' => $upload_path, 'image_file' => $fileLocation));
         $return = $image->resizeImage($p_width, $p_height);
         $image->writeImage($storagePath['path'] . '/' . 'photo-' . $memberId . '.' . $ext);
         $t_real_name = $return['thumb_location'] ? $return['thumb_location'] : $fileLocation;
         $im['img_width'] = $return['newWidth'] ? $return['newWidth'] : $image->cur_dimensions['width'];
         $im['img_height'] = $return['newHeight'] ? $return['newHeight'] : $image->cur_dimensions['height'];
         $return['final_location'] = $storagePath['dir'] . $fileLocation;
     } else {
         $im['img_width'] = $imageDimensions[0];
         $im['img_height'] = $imageDimensions[1];
         $return['final_location'] = $upload_dir . $fileLocation;
     }
     /* Main photo */
     // If we don't rebuild, the image is in the original location - which may not be in the /profile folder */
     //$return['final_location'] = $storagePath['dir'] . $fileLocation;
     $return['final_width'] = $im['img_width'];
     $return['final_height'] = $im['img_height'];
     /* Thumb */
     /* If we don't need to resize, it's same as the main image (which may get moved during IT'S resize) */
     $return['t_final_location'] = $needResize ? $t_im['img_location'] : $return['final_location'];
     $return['t_file_name'] = $t_im['img_location'];
     $return['t_final_width'] = $t_im['img_width'];
     $return['t_final_height'] = $t_im['img_height'];
     $return['status'] = 'ok';
     return $return;
 }
 /**
  * Saves the member's avatar
  *
  * @param		INT			Member's ID to save
  * @param		string		Upload field name [Default is "upload_avatar"]
  * @param		string		Avatar URL Field [Default is "avatar_url"]
  * @param		string		Gallery Avatar Directory Field [Default is "avatar_gallery"]
  * @param		string		Gallery Avatar Image Field [Default is "avatar_image"]
  * @author		Brandon Farber, Stolen By Matt 'Haxor' Mecham
  * <code>
  * Excepton Codes:
  * NO_MEMBER_ID:				A valid member ID was not passed.
  * NO_PERMISSION:				You do not have permission to change the avatar
  * UPLOAD_NO_IMAGE:				Nothing to upload
  * UPLOAD_INVALID_FILE_EXT:		Incorrect file extension (not an image)
  * UPLOAD_TOO_LARGE:			Upload is larger than allowed
  * UPLOAD_CANT_BE_MOVED:		Upload cannot be moved into the uploads directory
  * UPLOAD_NOT_IMAGE:			Upload is not an image, despite what the file extension says!
  * NO_AVATAR_TO_SAVE:			Nothing to save!
  * </code>
  */
 public function saveNewAvatar($member_id, $uploadFieldName = 'upload_avatar', $urlFieldName = 'avatar_url', $galleryFieldName = 'avatar_gallery', $avatarGalleryImage = 'avatar_image', $gravatarFieldName = 'gravatar_email')
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $avatar = array();
     list($p_width, $p_height) = explode("x", strtolower($this->settings['avatar_dims']));
     if (!$member_id) {
         throw new Exception("NO_MEMBER_ID");
     }
     $member = IPSMember::load($member_id, 'extendedProfile,groups');
     if (!$member['member_id']) {
         throw new Exception("NO_MEMBER_ID");
     }
     //-----------------------------------------
     // Allowed to upload pics for administrators?
     //-----------------------------------------
     if (IPS_AREA != 'public') {
         if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_photo_admin', 'members', 'members')) {
             throw new Exception("NO_PERMISSION");
         }
     }
     //-----------------------------------------
     // Upload?
     //-----------------------------------------
     if ($_FILES[$uploadFieldName]['name'] != "" and $_FILES[$uploadFieldName]['name'] != "none") {
         $this->settings['upload_dir'] = str_replace('&#46;', '.', $this->settings['upload_dir']);
         $real_name = 'av-' . $member_id;
         require_once IPS_KERNEL_PATH . 'classUpload.php';
         $upload = new classUpload();
         $upload->out_file_name = $real_name;
         $upload->out_file_dir = $this->settings['upload_dir'];
         $upload->max_file_size = $this->settings['avup_size_max'] * 1024 * 8;
         // Allow xtra for compression
         $upload->upload_form_field = $uploadFieldName;
         //-----------------------------------------
         // Populate allowed extensions
         //-----------------------------------------
         if (is_array($this->cache->getCache('attachtypes')) and count($this->cache->getCache('attachtypes'))) {
             foreach ($this->cache->getCache('attachtypes') as $data) {
                 if ($data['atype_photo']) {
                     if ($data['atype_extension'] == 'swf' and $this->settings['disable_flash']) {
                         continue;
                     }
                     $upload->allowed_file_ext[] = $data['atype_extension'];
                 }
             }
         }
         //-----------------------------------------
         // Upload...
         //-----------------------------------------
         $upload->process();
         //-----------------------------------------
         // Error?
         //-----------------------------------------
         if ($upload->error_no) {
             switch ($upload->error_no) {
                 case 1:
                     // No upload
                     throw new Exception("UPLOAD_NO_IMAGE");
                     break;
                 case 2:
                     // Invalid file ext
                     throw new Exception("UPLOAD_INVALID_FILE_EXT");
                     break;
                 case 3:
                     // Too big...
                     throw new Exception("UPLOAD_TOO_LARGE");
                     break;
                 case 4:
                     // Cannot move uploaded file
                     throw new Exception("UPLOAD_CANT_BE_MOVED");
                     break;
                 case 5:
                     // Possible XSS attack (image isn't an image)
                     throw new Exception("UPLOAD_NOT_IMAGE");
                     break;
             }
         }
         $real_name = $upload->parsed_file_name;
         $im = array();
         if (!$this->settings['disable_ipbsize'] and $upload->file_extension != '.swf') {
             $imageDimensions = getimagesize($this->settings['upload_dir'] . '/' . $real_name);
             if ($imageDimensions[0] > $p_width or $imageDimensions[1] > $p_height) {
                 require_once IPS_KERNEL_PATH . "classImage.php";
                 require_once IPS_KERNEL_PATH . "classImageGd.php";
                 $image = new classImageGd();
                 $image->init(array('image_path' => $this->settings['upload_dir'], 'image_file' => $real_name));
                 $return = $image->resizeImage($p_width, $p_height);
                 $image->writeImage($this->settings['upload_dir'] . '/' . $real_name);
                 $im['img_width'] = $return['newWidth'] ? $return['newWidth'] : $image->cur_dimensions['width'];
                 $im['img_height'] = $return['newHeight'] ? $return['newHeight'] : $image->cur_dimensions['height'];
             } else {
                 $im['img_width'] = $imageDimensions[0];
                 $im['img_height'] = $imageDimensions[1];
             }
         } else {
             $w = intval($this->request['man_width']) ? intval($this->request['man_width']) : $p_width;
             $h = intval($this->request['man_height']) ? intval($this->request['man_height']) : $p_height;
             $im['img_width'] = $w > $p_width ? $p_width : $w;
             $im['img_height'] = $h > $p_height ? $p_height : $h;
         }
         //-----------------------------------------
         // Set the "real" avatar..
         //-----------------------------------------
         $avatar['avatar_location'] = $real_name;
         $avatar['avatar_size'] = $im['img_width'] . 'x' . $im['img_height'];
         $avatar['avatar_type'] = 'upload';
     } else {
         if ($this->request[$urlFieldName] and IPSText::xssCheckUrl($this->request[$urlFieldName]) === true) {
             $ext = explode(",", $this->settings['avatar_ext']);
             $checked = 0;
             $av_ext = preg_replace("/^.*\\.(\\S+)\$/", "\\1", $this->request[$urlFieldName]);
             foreach ($ext as $v) {
                 if (strtolower($v) == strtolower($av_ext)) {
                     if ($v == 'swf' and $this->settings['disable_flash']) {
                         throw new Exception("INVALID_FILE_EXT");
                     }
                     $checked = 1;
                     break;
                 }
             }
             if ($checked != 1) {
                 throw new Exception("INVALID_FILE_EXT");
             }
             if (!$this->settings['disable_ipbsize']) {
                 if (!($img_size = @getimagesize($this->request[$urlFieldName]))) {
                     $img_size[0] = $p_width;
                     $img_size[1] = $p_height;
                 }
                 $im = IPSLib::scaleImage(array('max_width' => $p_width, 'max_height' => $p_height, 'cur_width' => $img_size[0], 'cur_height' => $img_size[1]));
             } else {
                 $w = intval($this->request['man_width']) ? intval($this->request['man_width']) : $p_width;
                 $h = intval($this->request['man_height']) ? intval($this->request['man_height']) : $p_height;
                 $im['img_width'] = $w > $p_width ? $p_width : $w;
                 $im['img_height'] = $h > $p_height ? $p_height : $h;
             }
             $avatar['avatar_location'] = trim($this->request[$urlFieldName]);
             $avatar['avatar_size'] = $im['img_width'] . 'x' . $im['img_height'];
             $avatar['avatar_type'] = 'url';
         } else {
             if (isset($this->request[$galleryFieldName]) and $this->request[$avatarGalleryImage]) {
                 $directory = '';
                 if ($this->request[$galleryFieldName]) {
                     $directory = preg_replace("/[^\\s\\w_-]/", "", urldecode($this->request[$galleryFieldName]));
                     if ($directory) {
                         $directory .= '/';
                     }
                 }
                 $filename = preg_replace("/[^\\s\\w\\._\\-\\[\\]\\(\\)]/", "", urldecode($this->request[$avatarGalleryImage]));
                 if (file_exists(DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_avatars/' . $directory . $filename)) {
                     $avatar['avatar_location'] = $directory . $filename;
                     $avatar['avatar_size'] = '';
                     $avatar['avatar_type'] = 'local';
                 }
             } else {
                 if ($this->request[$gravatarFieldName] && $this->request[$gravatarFieldName] && $this->settings['allow_gravatars']) {
                     $avatar['avatar_location'] = strtolower($this->request[$gravatarFieldName]);
                     $avatar['avatar_type'] = 'gravatar';
                 }
             }
         }
     }
     //-----------------------------------------
     // No avatar image?
     //-----------------------------------------
     if (!count($avatar)) {
         throw new Exception("NO_AVATAR_TO_SAVE");
     } else {
         if ($avatar['avatar_type'] != 'upload') {
             foreach (array('swf', 'jpg', 'jpeg', 'gif', 'png') as $ext) {
                 if (@file_exists($this->settings['upload_dir'] . "/av-" . $member_id . "." . $ext)) {
                     @unlink($this->settings['upload_dir'] . "/av-" . $member_id . "." . $ext);
                 }
             }
         }
     }
     //-----------------------------------------
     // Store and redirect
     //-----------------------------------------
     IPSMember::save($member_id, array('extendedProfile' => $avatar));
     return TRUE;
 }
 /**
  * Parse a member's profile photo
  *
  * @access	public
  * @param	mixed	Either array of member data, or member ID to self load
  * @return	array 	Member's photo details
  */
 public static function buildProfilePhoto($member)
 {
     //-----------------------------------------
     // Load the member?
     //-----------------------------------------
     if (!is_array($member) and $member == intval($member) and $member > 0) {
         $member = self::load($member, 'extendedProfile');
     } else {
         if ($member == 0) {
             $member = array();
         }
     }
     //-----------------------------------------
     // Facebook Sync
     //-----------------------------------------
     if (IPSLib::fbc_enabled() === TRUE) {
         if ($member['fb_uid'] and $member['fb_bwoptions']) {
             $_sync = time() - 86400;
             $_active = time() - 86400 * 90;
             /* We have a linked member and options, so check if they haven't sync'd in 24 hours and have been active in the past 90 days... */
             if ($member['fb_lastsync'] < $_sync and $member['last_visit'] > $_active) {
                 require_once IPS_ROOT_PATH . 'sources/classes/facebook/connect.php';
                 $facebook = new facebook_connect(ipsRegistry::instance());
                 try {
                     $member = $facebook->syncMember($member);
                 } catch (Exception $error) {
                     $msg = $error->getMessage();
                     switch ($msg) {
                         case 'NOT_LINKED':
                         case 'NO_MEMBER':
                             break;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Facebook?
     //-----------------------------------------
     if ($member['fb_photo'] and ipsRegistry::member()->getProperty('g_mem_info')) {
         $member['_has_photo'] = 1;
         /* Main... */
         $member['pp_main_photo'] = $member['fb_photo'];
         $member['pp_main_width'] = '*';
         $member['pp_main_height'] = '*';
         /* Thumb */
         $member['pp_thumb_photo'] = $member['fb_photo_thumb'];
         $member['pp_thumb_width'] = 50;
         $member['pp_thumb_height'] = 50;
         /* Mini */
         $member['pp_mini_photo'] = $member['fb_photo_thumb'];
         $member['pp_mini_width'] = 25;
         $member['pp_mini_height'] = 25;
     } else {
         //-----------------------------------------
         // Main photo
         //-----------------------------------------
         if (!$member['pp_main_photo'] or !ipsRegistry::member()->getProperty('g_mem_info')) {
             $member['pp_main_photo'] = ipsRegistry::$settings['img_url'] . '/profile/default_large.png';
             $member['pp_main_width'] = 150;
             $member['pp_main_height'] = 150;
             $member['_has_photo'] = 0;
         } else {
             $member['pp_main_photo'] = ipsRegistry::$settings['upload_url'] . '/' . $member['pp_main_photo'];
             $member['_has_photo'] = 1;
         }
         //-----------------------------------------
         // Thumbie
         //-----------------------------------------
         if (!$member['pp_thumb_photo'] or $member['pp_thumb_photo'] == 'profile/') {
             if ($member['_has_photo']) {
                 $member['pp_thumb_photo'] = $member['pp_main_photo'];
             } else {
                 $member['pp_thumb_photo'] = ipsRegistry::$settings['img_url'] . '/profile/default_thumb.png';
             }
             $member['pp_thumb_width'] = 50;
             $member['pp_thumb_height'] = 50;
         } else {
             if ($member['_has_photo']) {
                 $member['pp_thumb_photo'] = ipsRegistry::$settings['upload_url'] . '/' . $member['pp_thumb_photo'];
             } else {
                 $member['pp_thumb_photo'] = ipsRegistry::$settings['img_url'] . '/profile/default_thumb.png';
             }
         }
         //-----------------------------------------
         // Mini
         //-----------------------------------------
         $_data = IPSLib::scaleImage(array('max_height' => 25, 'max_width' => 25, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height']));
         $member['pp_mini_photo'] = $member['pp_thumb_photo'];
         $member['pp_mini_width'] = $_data['img_width'];
         $member['pp_mini_height'] = $_data['img_height'];
     }
     return $member;
 }
Пример #4
0
 /**
  * Return the HTML to display the tab
  *
  * @return	@e string
  */
 public function showTab($string)
 {
     //-----------------------------------------
     // Are we a member?
     //-----------------------------------------
     if (!$this->memberData['member_id']) {
         return '';
     }
     //-----------------------------------------
     // How many attachments do we have?
     //-----------------------------------------
     $mimes = $this->cache->getCache('attachtypes');
     $st = intval($this->request['st']);
     $each = 30;
     $where = '';
     if ($string) {
         $where = " AND attach_file LIKE '%{$string}%'";
     }
     /* Exclude PMs */
     $count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'attachments', 'where' => "attach_rel_module != 'msg' AND attach_member_id={$this->memberData['member_id']}" . $where));
     $rows = array();
     $pages = $this->registry->output->generatePagination(array('totalItems' => $count['total'], 'itemsPerPage' => $each, 'currentStartValue' => $st, 'seoTitle' => '', 'method' => 'nextPrevious', 'noDropdown' => true, 'ajaxLoad' => 'mymedia_content', 'baseUrl' => "app=core&amp;module=ajax&amp;section=media&amp;do=loadtab&amp;tabapp=core&amp;tabplugin=attachments&amp;search=" . urlencode($string)));
     $this->DB->build(array('select' => '*', 'from' => 'attachments', 'where' => "attach_rel_module != 'msg' AND attach_member_id={$this->memberData['member_id']}" . $where, 'order' => 'attach_date DESC', 'limit' => array($st, $each)));
     $outer = $this->DB->execute();
     while ($r = $this->DB->fetch($outer)) {
         if ($r['attach_thumb_location']) {
             $image = $this->settings['upload_url'] . '/' . $r['attach_thumb_location'];
             $dims = IPSLib::scaleImage(array('cur_width' => $r['attach_thumb_width'], 'cur_height' => $r['attach_thumb_height'], 'max_width' => 80, 'max_height' => 80));
             $width = $dims['img_width'];
             $height = $dims['img_height'];
         } else {
             $image = $this->settings['public_dir'] . $mimes[$r['attach_ext']]['atype_img'];
             $width = 0;
             $height = 0;
         }
         $rows[] = array('image' => $image, 'width' => $width, 'height' => $height, 'title' => IPSText::truncate($r['attach_file'], 25), 'desc' => '', 'insert' => "core:attachments:" . $r['attach_id']);
     }
     return $this->registry->output->getTemplate('editors')->mediaGenericWrapper($rows, $pages, 'core', 'attachments');
 }
Пример #5
0
 /**
  * Scale a remote image
  *
  * @param	string		URL
  * @param	int			Max width
  * @param	int			Max height
  * @return	string		width='#' height='#' string
  */
 public static function getTemplateDimensions($image, $width, $height)
 {
     if (empty($width) and empty($height)) {
         return;
     }
     if (!$image) {
         return;
     }
     //-----------------------------------------
     // Checking image dimensions via disk instead
     // of http is faster...can we try that..?
     //-----------------------------------------
     if (strpos($image, ipsRegistry::$settings['board_url']) === 0) {
         $image = DOC_IPS_ROOT_PATH . str_replace(ipsRegistry::$settings['board_url'], '', $image);
     }
     //-----------------------------------------
     // Dimensions
     // If set maxwidth and no maxheight, then we want the script to
     //	reduce based on width only.  And vice-versa.
     //-----------------------------------------
     $maxWidth = $width ? intval($width) : 1000000000;
     $maxHeight = $height ? intval($height) : 1000000000;
     //-----------------------------------------
     // Existing dims
     //-----------------------------------------
     $_dims = @getimagesize($image);
     if (!$_dims[0]) {
         return;
     }
     $_newDims = IPSLib::scaleImage(array('cur_width' => $_dims[0], 'cur_height' => $_dims[1], 'max_width' => $maxWidth, 'max_height' => $maxHeight));
     //-----------------------------------------
     // Process the tag and return the data
     //-----------------------------------------
     return " width='{$_newDims['img_width']}' height='{$_newDims['img_height']}'";
 }
Пример #6
0
 /**
  * Tagify a member's profile photo from data
  *
  * @param	array	Processed member data that has photo info
  * @param	string	Size (full/thumb/mini/small)
  * @param	bool	Add random string so no cache is used
  * @param	bool	If true, ipsUserPhoto class will not be added
  * @return	string
  */
 public static function buildPhotoTag($member, $size = 'thumb', $noCache = false, $noBorder = false)
 {
     $rnd = $noCache === true ? "?_r=" . md5(uniqid()) : '';
     $cls = '';
     switch ($size) {
         default:
         case 'thumb':
             $src = $member['pp_thumb_photo'];
             $w = $member['pp_thumb_width'];
             $h = $member['pp_thumb_height'];
             break;
         case 'main':
         case 'full':
             $src = $member['pp_main_photo'];
             $w = $member['pp_main_width'];
             $h = $member['pp_main_height'];
             break;
         case 'small':
             $_data = IPSLib::scaleImage(array('max_height' => 50, 'max_width' => 50, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height']));
             $src = $member['pp_thumb_photo'];
             $w = $_data['img_width'];
             $h = $_data['img_height'];
             $cls = 'ipsUserPhoto_medium';
             break;
         case 'mini':
             $_data = IPSLib::scaleImage(array('max_height' => 25, 'max_width' => 25, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height']));
             $src = $member['pp_thumb_photo'];
             $w = $_data['img_width'];
             $h = $_data['img_height'];
             $cls = 'ipsUserPhoto_mini';
             break;
         case 'inset':
             $_data = IPSLib::scaleImage(array('max_height' => 25, 'max_width' => 25, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height']));
             $src = $member['pp_thumb_photo'];
             $w = $_data['img_width'];
             $h = $_data['img_height'];
             $cls = 'ipsUserPhoto_inset';
             break;
         case 'icon':
             $_data = IPSLib::scaleImage(array('max_height' => 16, 'max_width' => 16, 'cur_width' => $member['pp_thumb_width'], 'cur_height' => $member['pp_thumb_height']));
             $src = $member['pp_thumb_photo'];
             $w = $_data['img_width'];
             $h = $_data['img_height'];
             $cls = 'ipsUserPhoto_icon';
             break;
     }
     $classes = $noBorder ? '' : "ipsUserPhoto {$cls}";
     return "<img src='" . $src . $rnd . "' width='" . $w . "' height='" . $h . "' class='" . $classes . "' />";
 }