本文整理汇总了PHP中JImage::createThumbs方法的典型用法代码示例。如果您正苦于以下问题:PHP JImage::createThumbs方法的具体用法?PHP JImage::createThumbs怎么用?PHP JImage::createThumbs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JImage
的用法示例。
在下文中一共展示了JImage::createThumbs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetThumbs
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.');
}
示例2: check
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;
}
示例3: getImages
/**
* 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;
}
示例4: getThumbnail
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;
}
}
示例5: getFormattedPoints
}
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 {
示例6: JImage
<?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&view=medals&task=detailsmedal&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
示例7: getAvatar
//.........这里部分代码省略.........
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 {