public function resetThumbs()
 {
     $items = self::getItems();
     //Get Params
     $params = JComponentHelper::getParams('com_spsimpleportfolio');
     $square = strtolower($params->get('square', '600x600'));
     $rectangle = strtolower($params->get('rectangle', '600x400'));
     $tower = strtolower($params->get('tower', '600x800'));
     $cropratio = $params->get('cropratio', 4);
     if (count($items)) {
         //Removing old thumbs
         foreach ($items as $item) {
             $folder = JPATH_ROOT . '/images/spsimpleportfolio/' . $item->alias;
             if (JFolder::exists($folder)) {
                 JFolder::delete($folder);
             }
         }
         //Creating Thumbs
         foreach ($items as $item) {
             $image = JPATH_ROOT . '/' . $item->image;
             $path = JPATH_ROOT . '/images/spsimpleportfolio/' . $item->alias;
             if (!file_exists($path)) {
                 JFolder::create($path, 0755);
             }
             $sizes = array($square, $rectangle, $tower);
             $image = new JImage($image);
             $image->createThumbs($sizes, $cropratio, $path);
         }
     }
     $this->setRedirect('index.php?option=com_config&view=component&component=com_spsimpleportfolio&path=&return=' . base64_encode('index.php?option=com_spsimpleportfolio'), 'Thumbnails generated.');
 }
 public function check()
 {
     $result = true;
     //Alias
     if (empty($this->alias)) {
         // Auto-fetch a alias
         $this->alias = JFilterOutput::stringURLSafe($this->title);
     } else {
         // Make sure nobody adds crap characters to the alias
         $this->alias = JFilterOutput::stringURLSafe($this->alias);
     }
     $existingAlias = FOFModel::getTmpInstance('Items', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
     if (!empty($existingAlias)) {
         $count = 0;
         $k = $this->getKeyName();
         foreach ($existingAlias as $item) {
             if ($item->{$k} != $this->{$k}) {
                 $count++;
             }
         }
         if ($count) {
             $this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
             $result = false;
         }
     }
     //Tags
     if (is_array($this->spsimpleportfolio_tag_id)) {
         if (!empty($this->spsimpleportfolio_tag_id)) {
             $this->spsimpleportfolio_tag_id = json_encode($this->spsimpleportfolio_tag_id);
         }
     }
     if (is_null($this->spsimpleportfolio_tag_id) || empty($this->spsimpleportfolio_tag_id)) {
         $this->spsimpleportfolio_tag_id = '';
     }
     //Generate Thumbnails
     if ($result) {
         $params = JComponentHelper::getParams('com_spsimpleportfolio');
         $square = strtolower($params->get('square', '600x600'));
         $rectangle = strtolower($params->get('rectangle', '600x400'));
         $tower = strtolower($params->get('tower', '600x800'));
         $cropratio = $params->get('cropratio', 4);
         if (!is_null($this->image)) {
             jimport('joomla.filesystem.file');
             jimport('joomla.filesystem.folder');
             jimport('joomla.image.image');
             $image = JPATH_ROOT . '/' . $this->image;
             $path = JPATH_ROOT . '/images/spsimpleportfolio/' . $this->alias;
             if (!file_exists($path)) {
                 JFolder::create($path, 0755);
             }
             $sizes = array($square, $rectangle, $tower);
             $image = new JImage($image);
             $image->createThumbs($sizes, $cropratio, $path);
         }
     }
     return $result;
 }
Beispiel #3
0
 /**
  * Method to load the images from the relative source
  * 
  * @param  JRegistry $params The module params object
  * 
  * @return object[]          An array of image objects
  *
  * @since  1.0
  */
 public static function getImages($params)
 {
     // Create the folder path
     $folder = JPath::clean(JPATH_BASE . DIRECTORY_SEPARATOR . $params->get('image_folder'));
     $cacheFolder = JPath::clean(JPATH_BASE . '/cache/mod_qluegallery/thumbs/' . $params->get('image_folder'));
     // Make sure the folder we are trying to load actually exists
     if (!JFolder::exists($folder)) {
         JError::raiseWarning(500, JText::_('MOD_QLUEGALLERY_NO_FOLDER_EXISTS'));
         return null;
     }
     // Load all images from the folder
     $images = JFolder::files($folder, '\\.(?:gif|jpg|png|jpeg)$');
     // Limit our found images
     $images = array_slice($images, 0, (int) $params->get('limit', 1));
     // Loop through each image and apply the image path
     foreach ($images as $key => $image) {
         // Path to the file
         $file = JPath::clean($folder . '/' . $image);
         $dimensions = $params->get('thumbnail_width', 150) . 'x' . $params->get('thumbnail_height', 150);
         $thumbnail = pathinfo($image, PATHINFO_FILENAME);
         $thumbExt = pathinfo($image, PATHINFO_EXTENSION);
         $thumbnail .= '_' . $dimensions . '.' . $thumbExt;
         // Create our image object
         $img = new stdClass();
         $img->file = $image;
         $img->full_path = JUri::root(true) . str_replace(JPATH_BASE, '', $file);
         $img->properties = JImage::getImageFileProperties($file);
         $img->thumbnail = str_replace(JPATH_BASE, '', $cacheFolder . '/' . $thumbnail);
         // If the thumbnail does not exist, create it
         if (!file_exists($cacheFolder . DIRECTORY_SEPARATOR . $thumbnail)) {
             // Get the image source
             $gd = new JImage($file);
             // Create the thumb folder if it does not exist
             if (!JFolder::exists($cacheFolder)) {
                 JFolder::create($cacheFolder);
             }
             // Create the thumbnails
             $gd->createThumbs($dimensions, JImage::CROP_RESIZE, $cacheFolder);
         }
         // Make sure the file paths are safe to use
         $img->full_path = str_replace('\\', '/', $img->full_path);
         $img->thumbnail = str_replace('\\', '/', $img->thumbnail);
         $images[$key] = $img;
     }
     return $images;
 }
Beispiel #4
0
 public static function getThumbnail($image)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $params = JComponentHelper::getComponent('com_digicom')->params;
     if (empty($image)) {
         return '';
     }
     if (!JFile::exists($image)) {
         return $image;
     }
     if ($params->get('image_thumb_enable')) {
         $image_thumb_width = $params->get('image_thumb_width');
         $image_thumb_height = $params->get('image_thumb_height');
         $image_thumb_method = $params->get('image_thumb_method', 6);
         $imageunique = md5($image . $image_thumb_width . $image_thumb_height);
         $path = JPATH_ROOT . '/images/digicom/products';
         JFolder::create($path);
         // Generate thumb name
         $jimage = new JImage($image);
         $filename = pathinfo($jimage->getPath(), PATHINFO_FILENAME);
         $fileExtension = pathinfo($jimage->getPath(), PATHINFO_EXTENSION);
         $thumbFileName = $filename . '_' . $image_thumb_width . 'x' . $image_thumb_height . '.' . $fileExtension;
         $thumbpath = JPATH_ROOT . '/images/digicom/products/' . $thumbFileName;
         $thumburl = JURI::root() . 'images/digicom/products/' . $thumbFileName;
         if (JFile::exists($thumbpath)) {
             return $thumburl;
         }
         $image = $jimage->createThumbs(array($image_thumb_width . 'x' . $image_thumb_height), $image_thumb_method, $path);
         $thumburl = str_replace(JPATH_SITE . '/', '', $image[0]->getPath());
         return $thumburl;
     } else {
         return $image;
     }
 }
Beispiel #5
0
}
echo "<b>" . JText::_('AUP_MYPOINTS') . "</b> : ";
?>
<span class="<?php 
echo $points_color;
?>
"><?php 
echo getFormattedPoints($this->currenttotalpoints);
?>
</span>
<?php 
if (@$this->userrankinfo) {
    if ($this->userrankinfo->image) {
        $pathimage = JPATH_COMPONENT . DS . 'assets/images/awards/large/' . $this->userrankinfo->image;
        $image = new JImage($pathimage);
        $userrankimg = $image->createThumbs(array('16x16'), JImage::CROP_RESIZE, JPATH_COMPONENT . DS . 'assets' . DS . 'images' . DS . 'awards' . DS . 'large' . DS . 'thumbs');
        $userrankimg = myImage::getLivePathImage($userrankimg);
        echo '<img src="' . $userrankimg . '" alt="" />';
    }
    echo " (" . $this->userrankinfo->rank . ")";
}
echo "<br />";
echo "<b>" . JText::_('AUP_LASTUPDATE') . "</b> : " . JHTML::_('date', $this->lastupdate, JText::_('DATE_FORMAT_LC2')) . "<br />";
echo "<b>" . JText::_('AUP_MEMBER_SINCE') . "</b> : " . JHTML::_('date', $this->userinfo->registerDate, JText::_('DATE_FORMAT_LC3')) . "<br />";
echo "<b>" . JText::_('AUP_LAST_ONLINE') . "</b> : " . nicetime($this->userinfo->lastvisitDate) . "<br />";
if ($this->referraluser != '') {
    if ($this->params->get('show_links_to_users', 1)) {
        $_user_info = AlphaUserPointsHelper::getUserInfo($this->referraluser);
        $linktoprofilreferral = getProfileLink($_profilelink, $_user_info);
        $linktoprofilreferral = "<a href=\"" . JRoute::_($linktoprofilreferral) . "\">" . $this->referralname . "</a>";
    } else {
Beispiel #6
0
		<?php 
for ($i = 0, $n = count($this->levelrank); $i < $n; $i++) {
    $row =& $this->levelrank[$i];
    $icone = '';
    $startmedals = '';
    $endmedals = '';
    if ($row->nummedals) {
        $link = 'index.php?option=com_alphauserpoints&amp;view=medals&amp;task=detailsmedal&amp;cid=' . $row->id;
        $startmedals = '<a href="' . $link . '" class="thumbnail">';
        $endmedals = '</a>';
    }
    if ($this->params->get('showImage')) {
        if ($row->image) {
            $pathimage = JPATH_COMPONENT . DS . 'assets/images/awards/large/' . $row->image;
            $image = new JImage($pathimage);
            $icone = $image->createThumbs(array($this->params->get('heightImage', 32) . 'x' . $this->params->get('heightImage', 32)), JImage::CROP_RESIZE, JPATH_COMPONENT . DS . 'assets' . DS . 'images' . DS . 'awards' . DS . 'large' . DS . 'thumbs');
            $icone = myImage::getLivePathImage($icone);
            $icone = '<img src="' . $icone . '" alt="" />';
        } else {
            $icone = '';
        }
    } else {
        if ($row->icon) {
            $pathicon = JURI::root() . 'components/com_alphauserpoints/assets/images/awards/icons/';
            $icone = '<img src="' . $pathicon . $row->icon . '" width="16" height="16" ';
        } else {
            $icone = '';
        }
    }
    ?>
			<tr class="cat-list-row<?php 
Beispiel #7
0
function getAvatar($useAvatarFrom, $userinfo, $height = '', $width = '', $class = '')
{
    $db = JFactory::getDBO();
    $avatar = '';
    $setheight = $height != '' ? 'height="' . $height . '"' : '';
    $setwidth = $width != '' ? 'width="' . $width . '"' : 'width="' . $height . '"';
    if ($width == '') {
        $width = $height;
    }
    $defaultAvatarAUP = JURI::root() . 'components/com_alphauserpoints/assets/images/avatars/generic_gravatar_grey.png';
    switch ($useAvatarFrom) {
        case 'gravatar':
            $email = $userinfo->email;
            $gravatar_url = 'http://www.gravatar.com/avatar/';
            $gravatar_url .= md5(strtolower(trim($email)));
            $gravatar_url .= '?d=' . urlencode($defaultAvatarAUP);
            if ($height) {
                $gravatar_url .= '&amp;s=$height';
            } else {
                $gravatar_url .= '&amp;s=80';
            }
            $avatar = '<img src="' . $gravatar_url . '" alt=""/>';
            break;
        case 'kunena':
            if (!defined("_AUP_KUNENA_PATH")) {
                define('_AUP_KUNENA_PATH', JPATH_ROOT . '/media/kunena');
            }
            if (!defined("_AUP_KUNENA_LIVE_PATH")) {
                define('_AUP_KUNENA_LIVE_PATH', JURI::base(true) . '/media/kunena');
            }
            $Avatarname = $userinfo->avatar;
            $query = "SELECT a.*, b.* FROM #__kunena_users as a" . "\n LEFT JOIN #__users as b on b.id=a.userid" . "\n where a.userid=" . $userinfo->id;
            $db->setQuery($query);
            $userProfilKunena = $db->loadObject();
            $fb_avatar = @$userProfilKunena->avatar;
            if ($fb_avatar != '') {
                if (!file_exists(_AUP_KUNENA_PATH . '/avatars/' . $fb_avatar)) {
                    $avatar = _AUP_KUNENA_LIVE_PATH . '/avatars/' . $fb_avatar;
                } else {
                    $avatar = _AUP_KUNENA_LIVE_PATH . '/avatars/' . $fb_avatar;
                }
            } else {
                $avatar = _AUP_KUNENA_LIVE_PATH . '/avatars/nophoto.jpg';
            }
            break;
        case 'cb':
            $query = "SELECT avatar FROM #__comprofiler WHERE user_id = '" . $userinfo->id . "'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if (!empty($result)) {
                $avatar = JURI::base(true) . "/images/comprofiler/" . $result;
            } else {
                $avatar = JURI::base(true) . "/components/com_comprofiler/plugin/templates/default/images/avatar/nophoto_n.png";
            }
            break;
        case 'cbe':
            global $mosConfig_lang;
            $query = "SELECT avatar, avatarapproved FROM #__cbe WHERE user_id ='" . $userinfo->id . "'";
            $db->setQuery($query);
            $result = $db->loadObject();
            $avatar = $result->avatar;
            if (file_exists(JPATH_ROOT . DS . "components" . DS . "com_cbe" . DS . "images" . DS . $mosConfig_lang)) {
                $uimagepath = JURI::base(true) . "/components/com_cbe/images/" . $mosConfig_lang . "/";
            } else {
                $uimagepath = JURI::base(true) . "/components/com_cbe/images/english/";
            }
            if ($result->avatarapproved == 0) {
                $avatar = $uimagepath . "pendphoto.jpg";
            } elseif ($result->avatar == '' || $result->avatar == null) {
                $avatar = $uimagepath . "nophoto.jpg";
            } else {
                $avatar = JURI::base(true) . "/images/cbe/" . $avatar;
            }
            break;
        case 'jomsocial':
            $query = "SELECT avatar FROM #__community_users WHERE userid = '" . $userinfo->id . "'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if (!empty($result)) {
                $avatar = JURI::base(false) . $result;
            } else {
                $avatar = JURI::base(true) . "/components/com_community/assets/default_thumb.jpg";
            }
            break;
        case 'clexus':
            $query = "SELECT picture FROM #__mypms_profiles WHERE `name`='" . $userinfo->username . "'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if (!empty($result)) {
                $avatar = $result;
            } else {
                $avatar = '';
            }
            break;
        case 'K2':
            $query = "SELECT image FROM #__k2_users WHERE userID='" . $userinfo->id . "'";
            $db->setQuery($query);
            $result = $db->loadResult();
            if (!empty($result)) {
                $avatar = JURI::base(true) . "/media/k2/users/" . $result;
            } else {
                $avatar = '';
            }
            break;
        case 'alphauserpoints':
            if (!defined("_AUP_AVATAR_LIVE_PATH")) {
                define('_AUP_AVATAR_LIVE_PATH', JURI::base(true) . '/components/com_alphauserpoints/assets/images/avatars/');
            }
            $usr_avatar = $userinfo->avatar != '' ? JPATH_COMPONENT . DS . 'assets/images/avatars/' . $userinfo->avatar : JPATH_COMPONENT . DS . 'assets/images/avatars/generic_gravatar_grey.gif';
            if (file_exists($usr_avatar)) {
                $image = new JImage($usr_avatar);
                $avatar = $image->createThumbs(array($width . 'x' . $height), JImage::CROP_RESIZE, JPATH_COMPONENT . DS . 'assets' . DS . 'images' . DS . 'avatars' . DS . 'thumbs');
                $avatar = myImage::getLivePathImage($avatar);
            } else {
                $avatar = $defaultAvatarAUP;
            }
            break;
        case 'jomWALL':
            // for version 2.5
            $config = JComponentHelper::getParams('com_awdwall');
            $template = $config->get('temp', 'blue');
            $avatarintergration = $config->get('avatarintergration', '0');
            $query = "SELECT facebook_id FROM #__jconnector_ids WHERE user_id = " . (int) $userId;
            $db->setQuery($query);
            $facebook_id = $db->loadResult();
            if ($facebook_id) {
                $avatar = 'https://graph.facebook.com/' . $facebook_id . '/picture?type=large';
            } else {
                $query = 'SELECT avatar FROM #__awd_wall_users WHERE user_id = ' . (int) $userId;
                $db = JFactory::getDBO();
                $db->setQuery($query);
                $img = $db->loadResult();
                if ($img == NULL) {
                    $avatar = JURI::root() . "components/com_awdwall/images/" . $template . "/" . $template . "51.png";
                } else {
                    $avatar = JURI::root() . "images/wallavatar/" . $userId . "/thumb/tn51" . $img;
                }
            }
            if ($avatarintergration == 1) {
                if (file_exists(JPATH_SITE . '/components/com_k2/k2.php')) {
                    require_once JPATH_SITE . '/components/com_k2/helpers/utilities.php';
                    $avatar = K2HelperUtilities::getAvatar($userId);
                }
            } else {
                if ($avatarintergration == 2) {
                    if (file_exists(JPATH_SITE . '/components/com_easyblog/easyblog.php')) {
                        require_once JPATH_SITE . '/components/com_easyblog/helpers/helper.php';
                        $blogger = EasyBlogHelper::getTable('Profile', 'Table');
                        $blogger->load($userId);
                        $avatar = $blogger->getAvatar();
                    }
                } else {
                    if ($avatarintergration == 3) {
                        if (file_exists(JPATH_SITE . '/components/com_alphauserpoints/alphauserpoints.php')) {
                            require_once JPATH_SITE . '/components/com_alphauserpoints/helper.php';
                            require_once JPATH_SITE . '/components/com_alphauserpoints/helpers/helpers.php';
                            $_user_info = AlphaUserPointsHelper::getUserInfo($referrerid = '', $userId);
                            $com_params = JComponentHelper::getParams('com_alphauserpoints');
                            $useAvatarFrom = $com_params->get('useAvatarFrom');
                            $height = 50;
                            $width = 50;
                            $avatar = getAvatar($useAvatarFrom, $_user_info, $height, $width);
                            $doc = new DOMDocument();
                            $doc->loadHTML($avatar);
                            $imageTags = $doc->getElementsByTagName('img');
                            foreach ($imageTags as $tag) {
                                $avatar = $tag->getAttribute('src');
                            }
                        }
                    }
                }
            }
        default:
            $avatar = '';
    }
    if ($avatar && $useAvatarFrom != 'gravatar' && $useAvatarFrom != 'jomsocial') {
        $avatar = '<img src="' . $avatar . '" border="0" alt="" ' . $setheight . $setwidth . ' ' . $class . ' />';
    } elseif ($useAvatarFrom == 'jomsocial') {
        $avatar = '<img src="' . $avatar . '" border="0" alt="" ' . $setheight . $setwidth . ' />';
    }
    return $avatar;
}