/** * Get ad image * * @return image; * @access public */ function ossn_ad_image($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'object'; $photo->subtype = 'ossnads'; $photos = $photo->getFiles(); if (isset($photos->{0}->value) && !empty($photos->{0}->value)) { $datadir = ossn_get_userdata("object/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } }
/** * Get user profile photos album * * @params = $user User guid * * @return object; */ public function GetUserProfilePhotos($user) { $photos = new OssnFile(); $photos->owner_guid = $user; $photos->type = 'user'; $photos->subtype = 'profile:photo'; $photos->order_by = 'guid DESC'; return $photos->getFiles(); }
* OpenSource-SocialNetwork * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://opensource-socialnetwork.com/licence * @link http://www.opensource-socialnetwork.com/licence */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:photo'; $file->setFile('userphoto'); $file->setPath('profile/photo/'); if ($file->addFile()) { $resize = $file->getFiles(); if (isset($resize->{0}->value)) { $guid = ossn_loggedin_user()->guid; $datadir = ossn_get_userdata("user/{$guid}/{$resize->{0}->value}"); $file_name = str_replace('profile/photo/', '', $resize->{0}->value); $sizes = ossn_user_image_sizes(); foreach ($sizes as $size => $params) { $params = explode('x', $params); $width = $params[1]; $height = $params[0]; $resized = ossn_resize_image($datadir, $width, $height, true); file_put_contents(ossn_get_userdata("user/{$guid}/profile/photo/{$size}_{$file_name}"), $resized); } } echo 1; } else {
/** * Get user default profile photo guid * * @return bool */ function get_profile_photo_guid($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:photo'; $photos = $photo->getFiles(); if (isset($photos->{0}->guid)) { return $photos->{0}->guid; } return false; }
/** * Get user default cover photo * * @return string|null data; */ function get_cover_photo($guid, $params = array()) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:cover'; $photos = $photo->getFiles(); if (isset($photos->{0}->value)) { if (!empty($params[1]) && $params[1] == 1) { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); echo ossn_resize_image($datadir, 170, 170, true); } else { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } } else { redirect('components/OssnProfile/images/transparent.png'); } }
<?php /** * Open Source Social Network * * @package (Informatikon.com).ossn * @author OSSN Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $file = new OssnFile(); $file->owner_guid = ossn_loggedin_user()->guid; $file->type = 'user'; $file->subtype = 'profile:cover'; $file->setFile('coverphoto'); $file->setPath('profile/cover/'); $file->setExtension(array('jpg', 'png', 'jpeg', 'gif')); if ($file->addFile()) { $newcover = $file->getFiles(); $ossnprofile = new OssnProfile(); $ossnprofile->ResetCoverPostition($file->owner_guid); $ossnprofile->addPhotoWallPost($file->owner_guid, $newcover->{0}->guid, 'cover:photo'); echo 1; } else { echo 0; }
function get_cover_photo($guid) { $photo = new OssnFile(); $photo->owner_guid = $guid; $photo->type = 'user'; $photo->subtype = 'profile:cover'; $photos = $photo->getFiles(); if (isset($photos->{0}->value)) { $datadir = ossn_get_userdata("user/{$guid}/{$photos->{0}->value}"); return file_get_contents($datadir); } else { redirect('components/OssnProfile/images/transparent.png'); } }