本文整理汇总了PHP中PhocaGalleryPath::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryPath::getPath方法的具体用法?PHP PhocaGalleryPath::getPath怎么用?PHP PhocaGalleryPath::getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhocaGalleryPath
的用法示例。
在下文中一共展示了PhocaGalleryPath::getPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$path = PhocaGalleryPath::getPath();
$this->tmpl['avatarpathabs'] = $path->avatar_abs . DS . 'thumbs' . DS . 'phoca_thumb_s_';
$this->tmpl['avatarpathrel'] = $path->avatar_rel . 'thumbs/phoca_thumb_s_';
$this->tmpl['avtrpathrel'] = $path->avatar_rel;
JHTML::stylesheet('administrator/components/com_phocagallery/assets/phocagallery.css');
$document =& JFactory::getDocument();
$document->addCustomTag(PhocaGalleryRenderAdmin::renderIeCssLink(1));
// Button
JHTML::_('behavior.modal', 'a.modal_phocagalleryusers');
$this->button = new JObject();
$this->button->set('modal', true);
$this->button->set('methodname', 'modal-button');
//$this->button->set('link', $link);
$this->button->set('text', JText::_('COM_PHOCAGALLERY_DISPLAY_IMAGE_DETAIL'));
//$this->button->set('name', 'image');
$this->button->set('modalname', 'modal_phocagalleryusers');
$this->button->set('options', "{handler: 'image', size: {x: 200, y: 150}}");
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}
示例2: display
function display($tpl = null)
{
$app = JFactory::getApplication();
$document =& JFactory::getDocument();
$uri =& JFactory::getURI();
//$menus = &JSite::getMenu();
$menus = JFactory::getApplication()->getMenu();
$menu = $menus->getActive();
$this->params =& $app->getParams();
$this->tmpl['path'] =& PhocaGalleryPath::getPath();
$model =& $this->getModel();
// PARAMS
$this->tmpl['displaycatnametitle'] = $this->params->get('display_cat_name_title', 1);
$display_cat_name_breadcrumbs = $this->params->get('display_cat_name_breadcrumbs', 1);
$this->tmpl['showpageheading'] = $this->params->get('show_page_heading', 1);
$this->tmpl['cooliris3d_wall_width'] = $this->params->get('cooliris3d_wall_width', 600);
$this->tmpl['cooliris3d_wall_height'] = $this->params->get('cooliris3d_wall_height', 370);
$this->tmpl['pmt'] = PhocaGalleryRenderInfo::getPhocaIc((int) $this->params->get('display_phoca_info', 1));
$this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', '');
$this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', '');
$this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0);
$this->tmpl['customcss'] = $this->params->get('custom_css', '');
$idCategory = JRequest::getVar('id', 0, 'get', 'int');
// CSS
JHtml::stylesheet('components/com_phocagallery/assets/phocagallery.css');
if ($this->tmpl['enablecustomcss'] == 1) {
JHtml::stylesheet('components/com_phocagallery/assets/phocagallerycustom.css');
PhocaGalleryRenderFront::displayCustomCSS($this->tmpl['customcss']);
}
if ((int) $idCategory > 0) {
$category = $model->getCategory($idCategory);
$this->_prepareDocument($category);
// Define image tag attributes
/*if (!empty ($category->image)) {
$attribs['align'] = '"'.$category->image_position.'"';
$attribs['hspace'] = '"6"';
$this->tmpl['image'] = JHtml::_('image', 'images/stories/'.$category->image, '', $attribs);
}*/
$this->_addBreadCrumbs($category, isset($menu->query['id']) ? $menu->query['id'] : 0, $display_cat_name_breadcrumbs);
// ASIGN
$this->tmpl['display_category'] = 1;
$this->assignRef('tmpl', $this->tmpl);
$this->assignRef('category', $category);
$this->assignRef('params', $this->params);
} else {
$this->tmpl['display_category'] = 0;
$this->assignRef('tmpl', $this->tmpl);
}
parent::display($tpl);
}
示例3: display
public function display($tpl = null)
{
$params = JComponentHelper::getParams('com_phocagallery');
JResponse::allowCache(false);
JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
$document = JFactory::getDocument();
//$document->addCustomTag(PhocaGalleryRenderAdmin::renderIeCssLink(1));
$path = PhocaGalleryPath::getPath();
$this->field = JRequest::getVar('field');
$this->fce = 'phocaSelectFolder_' . $this->field;
$this->assignRef('session', JFactory::getSession());
$this->assign('path_orig_rel', $path->image_rel);
$this->assignRef('folders', $this->get('folders'));
$this->assignRef('state', $this->get('state'));
parent::display($tpl);
}
示例4: getImageSize
function getImageSize($filename, $returnString = 0, $extLink = 0)
{
phocagalleryimport('phocagallery.image.image');
phocagalleryimport('phocagallery.path.path');
if ($extLink == 1) {
$fileNameAbs = $filename;
} else {
$path =& PhocaGalleryPath::getPath();
$fileNameAbs = JPath::clean($path->image_abs . $filename);
if (!JFile::exists($fileNameAbs)) {
$fileNameAbs = $path->image_abs_front . 'phoca_thumb_l_no_image.png';
}
}
if ($returnString == 1) {
$imageSize = @getimagesize($fileNameAbs);
return $imageSize[0] . ' x ' . $imageSize[1];
} else {
return @getimagesize($fileNameAbs);
}
}
示例5: getList
function getList()
{
static $list;
// Only process the list once per request
if (is_array($list)) {
return $list;
}
// Get current path from request
$current = $this->getState('folder');
// If undefined, set to empty
if ($current == 'undefined') {
$current = '';
}
//Get folder variables from Helper
$path = PhocaGalleryPath::getPath();
// Initialize variables
if (strlen($current) > 0) {
$orig_path = JPath::clean($path->image_abs . $current);
} else {
$orig_path = $path->image_abs;
}
$orig_path_server = str_replace(DS, '/', $path->image_abs);
$folders = array();
// Get the list of files and folders from the given folder
$folder_list = JFolder::folders($orig_path, '', false, false, array(0 => 'thumbs'));
// Iterate over the folders if they exist
if ($folder_list !== false) {
foreach ($folder_list as $folder) {
$tmp = new JObject();
$tmp->name = basename($folder);
$tmp->path_with_name = str_replace(DS, '/', JPath::clean($orig_path . DS . $folder));
$tmp->path_without_name_relative = $path->image_rel . str_replace($orig_path_server, '', $tmp->path_with_name);
$tmp->path_with_name_relative_no = str_replace($orig_path_server, '', $tmp->path_with_name);
$folders[] = $tmp;
}
}
$list = array('folders' => $folders);
return $list;
}
示例6: multipleupload
function multipleupload()
{
JResponse::allowCache(false);
// Chunk Files
header('Content-type: text/plain; charset=UTF-8');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// Invalid Token
JRequest::checkToken('request') or jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 100, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_INVALID_TOKEN'))));
jimport('joomla.client.helper');
$app = JFactory::getApplication();
$ftp = JClientHelper::setCredentialsFromRequest('ftp');
$user = JFactory::getUser();
$path = PhocaGalleryPath::getPath();
$return = $this->input->get('return-url', null, 'base64');
$format = $this->input->get('format', 'html', 'cmd');
$viewBack = $this->input->get('viewback', '', 'string');
$tab = $this->input->get('tab', 0, 'int');
$catid = $this->input->get('id', '', 'string');
$rating = $this->input->get('rating', '', 'string');
$Itemid = $this->input->get('Itemid', 0, 'int');
$limitStart = $this->input->get('limitstart', 0, 'int');
$paramsC = JComponentHelper::getParams('com_phocagallery');
$model = $this->getModel('category');
$catid = (int) $catid;
// USER RIGHT - UPLOAD - - - - - - - - - - -
// 2, 2 means that user access will be ignored in function getUserRight for display Delete button
$rightDisplayUpload = 0;
$catAccess = PhocaGalleryAccess::getCategoryAccess((int) $catid);
if (!empty($catAccess)) {
$rightDisplayUpload = PhocaGalleryAccess::getUserRight('uploaduserid', $catAccess->uploaduserid, 2, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
}
// - - - - - - - - - - - - - - - - - - - - - -
// USER RIGHT - FOLDER - - - - - - - - - - - -
$rightFolder = '';
if (isset($catAccess->userfolder)) {
$rightFolder = $catAccess->userfolder;
}
// - - - - - - - - - - - - - - - - - - - - - -
if ($rightDisplayUpload == 1) {
if ($rightFolder == '') {
jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_USER_FOLDER_NOT_DEFINED'))));
return false;
}
if (!JFolder::exists($path->image_abs . $rightFolder . DS)) {
jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_USER_FOLDER_NOT_EXISTS'))));
return false;
}
// Check the size of all images by users
/* $maxUserImageSize = (int)$paramsC->get( 'user_images_max_size', 20971520 );
$allFileSize = PhocaGalleryFileUploadFront::getSizeAllOriginalImages($file, $this->_user->id);
if ($maxUserImageSize > 0 && (int) $allFileSize > $maxUserImageSize) {
$errUploadMsg = JText::_('COM_PHOCAGALLERY_WARNING_USERIMAGES_TOOLARGE');
$app->redirect($redirectUrl, $errUploadMsg);
return false;
}*/
// Sending and setting data for common realsingleupload function
$this->input->set('folder', $rightFolder);
//Set the right path for uploaded image (category folder included)
$this->input->set('return-url', base64_encode($return));
// set return url
$fileName = PhocaGalleryFileUpload::realMultipleUpload(1);
if ($fileName != '') {
// Saving file name into database with relative path
$fileName = $rightFolder . '/' . strtolower($fileName);
if (PhocaGalleryControllerCategory::save((int) $catid, $fileName, false, $succeeded, $errUploadMsg, false)) {
jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'OK', 'code' => 200, 'message' => JText::_('COM_PHOCAGALERY_SUCCESS') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_IMAGES_UPLOADED'))));
return true;
} else {
jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE'))));
return false;
}
}
} else {
jexit(json_encode(array('jsonrpc' => '2.0', 'result' => 'error', 'code' => 104, 'message' => JText::_('COM_PHOCAGALLERY_ERROR') . ': ', 'details' => JTEXT::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'))));
return false;
}
}
示例7: getOrCreateThumbnail
function getOrCreateThumbnail($fileNo, $refreshUrl, $small = 0, $medium = 0, $large = 0, $frontUpload = 0)
{
if ($frontUpload) {
$returnFrontMessage = '';
}
$onlyThumbnailInfo = 0;
if ($small == 0 && $medium == 0 && $large == 0) {
$onlyThumbnailInfo = 1;
}
$paramsC = JComponentHelper::getParams('com_phocagallery');
$additional_thumbnails = $paramsC->get('additional_thumbnails', 0);
$path = PhocaGalleryPath::getPath();
$origPathServer = str_replace(DS, '/', $path->image_abs);
$file['name'] = PhocaGalleryFile::getTitleFromFile($fileNo, 1);
$file['name_no'] = ltrim($fileNo, '/');
$file['name_original_abs'] = PhocaGalleryFile::getFileOriginal($fileNo);
$file['name_original_rel'] = PhocaGalleryFile::getFileOriginal($fileNo, 1);
$file['path_without_file_name_original'] = str_replace($file['name'], '', $file['name_original_abs']);
$file['path_without_file_name_thumb'] = str_replace($file['name'], '', $file['name_original_abs'] . 'thumbs' . DS);
//$file['path_without_name'] = str_replace(DS, '/', JPath::clean($origPathServer));
//$file['path_with_name_relative_no'] = str_replace($origPathServer, '', $file['name_original']);
/*
$file['path_with_name_relative'] = $path['orig_rel_ds'] . str_replace($origPathServer, '', $file['name_original']);
$file['path_with_name_relative_no'] = str_replace($origPathServer, '', $file['name_original']);
$file['path_without_name'] = str_replace(DS, '/', JPath::clean($origPath.DS));
$file['path_without_name_relative'] = $path['orig_rel_ds'] . str_replace($origPathServer, '', $file['path_without_name']);
$file['path_without_name_relative_no'] = str_replace($origPathServer, '', $file['path_without_name']);
$file['path_without_name_thumbs'] = $file['path_without_name'] .'thumbs';
$file['path_without_file_name_original'] = str_replace($file['name'], '', $file['name_original']);
$file['path_without_name_thumbs_no'] = str_replace($file['name'], '', $file['name_original'] .'thumbs');*/
$ext = strtolower(JFile::getExt($file['name']));
switch ($ext) {
case 'jpg':
case 'png':
case 'gif':
case 'jpeg':
//Get File thumbnails name
$thumbNameS = PhocaGalleryFileThumbnail::getThumbnailName($fileNo, 'small');
$file['thumb_name_s_no_abs'] = $thumbNameS->abs;
$file['thumb_name_s_no_rel'] = $thumbNameS->rel;
$thumbNameM = PhocaGalleryFileThumbnail::getThumbnailName($fileNo, 'medium');
$file['thumb_name_m_no_abs'] = $thumbNameM->abs;
$file['thumb_name_m_no_rel'] = $thumbNameM->rel;
$thumbNameL = PhocaGalleryFileThumbnail::getThumbnailName($fileNo, 'large');
$file['thumb_name_l_no_abs'] = $thumbNameL->abs;
$file['thumb_name_l_no_rel'] = $thumbNameL->rel;
// Don't create thumbnails from watermarks...
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($file['name']);
if ($dontCreateThumb == 1) {
$onlyThumbnailInfo = 1;
// WE USE $onlyThumbnailInfo FOR NOT CREATE A THUMBNAIL CLAUSE
}
// We want only information from the pictures OR
if ($onlyThumbnailInfo == 0) {
$thumbInfo = $fileNo;
//Create thumbnail folder if not exists
$errorMsg = 'ErrorCreatingFolder';
$creatingFolder = PhocaGalleryFileThumbnail::createThumbnailFolder($file['path_without_file_name_original'], $file['path_without_file_name_thumb'], $errorMsg);
switch ($errorMsg) {
case 'Success':
//case 'ThumbnailExists':
//case 'ThumbnailExists':
case 'DisabledThumbCreation':
//case 'OnlyInformation':
break;
default:
// BACKEND OR FRONTEND
if ($frontUpload != 1) {
PhocaGalleryRenderProcess::getProcessPage($file['name'], $thumbInfo, $refreshUrl, $errorMsg, $frontUpload);
exit;
} else {
$returnFrontMessage = $errorMsg;
}
break;
}
// Folder must exist
if (JFolder::exists($file['path_without_file_name_thumb'])) {
$errorMsgS = $errorMsgM = $errorMsgL = '';
//Small thumbnail
if ($small == 1) {
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], $thumbNameS->abs, 'small', $frontUpload, $errorMsgS);
if ($additional_thumbnails == 2 || $additional_thumbnails == 3) {
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s1_', $thumbNameS->abs), 'small1', $frontUpload, $errorMsgS);
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s2_', $thumbNameS->abs), 'small2', $frontUpload, $errorMsgS);
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_s_', 'phoca_thumb_s3_', $thumbNameS->abs), 'small3', $frontUpload, $errorMsgS);
}
} else {
$errorMsgS = 'ThumbnailExists';
// in case we only need medium or large, because of if clause bellow
}
//Medium thumbnail
if ($medium == 1) {
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], $thumbNameM->abs, 'medium', $frontUpload, $errorMsgM);
if ($additional_thumbnails == 1 || $additional_thumbnails == 3) {
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m1_', $thumbNameM->abs), 'medium1', $frontUpload, $errorMsgM);
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m2_', $thumbNameM->abs), 'medium2', $frontUpload, $errorMsgM);
PhocaGalleryFileThumbnail::createFileThumbnail($file['name_original_abs'], str_replace('phoca_thumb_m_', 'phoca_thumb_m3_', $thumbNameM->abs), 'medium3', $frontUpload, $errorMsgM);
}
} else {
//.........这里部分代码省略.........
示例8: imageMagic
/**
* need GD library (first PHP line WIN: dl("php_gd.dll"); UNIX: dl("gd.so");
* www.boutell.com/gd/
* interval.cz/clanky/php-skript-pro-generovani-galerie-obrazku-2/
* cz.php.net/imagecopyresampled
* www.linuxsoft.cz/sw_detail.php?id_item=871
* www.webtip.cz/art/wt_tech_php/liquid_ir.html
* php.vrana.cz/zmensovani-obrazku.php
* diskuse.jakpsatweb.cz/
*
* @param string $fileIn Vstupni soubor (mel by existovat)
* @param string $fileOut Vystupni soubor, null ho jenom zobrazi (taky kdyz nema pravo se zapsat :)
* @param int $width Vysledna sirka (maximalni)
* @param int $height Vysledna vyska (maximalni)
* @param bool $crop Orez (true, obrazek bude presne tak velky), jinak jenom Resample (udane maximalni rozmery)
* @param int $typeOut IMAGETYPE_type vystupniho obrazku
* @return bool Chyba kdyz vrati false
*/
public static function imageMagic($fileIn, $fileOut = null, $width = null, $height = null, $crop = null, $typeOut = null, $watermarkParams = array(), $frontUpload = 0, &$errorMsg)
{
$params = JComponentHelper::getParams('com_phocagallery');
$jfile_thumbs = $params->get('jfile_thumbs', 1);
$jpeg_quality = $params->get('jpeg_quality', 85);
$jpeg_quality = PhocaGalleryImage::getJpegQuality($jpeg_quality);
$fileWatermark = '';
// While front upload we don't display the process page
if ($frontUpload == 0) {
$stopText = PhocaGalleryRenderProcess::displayStopThumbnailsCreating('processpage');
echo $stopText;
}
// Memory - - - - - - - -
$memory = 8;
$memoryLimitChanged = 0;
$memory = (int) ini_get('memory_limit');
if ($memory == 0) {
$memory = 8;
}
// - - - - - - - - - - -
if ($fileIn !== '' && JFile::exists($fileIn)) {
// array of width, height, IMAGETYPE, "height=x width=x" (string)
list($w, $h, $type) = GetImageSize($fileIn);
if ($w > 0 && $h > 0) {
// we got the info from GetImageSize
// size of the image
if ($width == null || $width == 0) {
// no width added
$width = $w;
} else {
if ($height == null || $height == 0) {
// no height, adding the same as width
$height = $width;
}
}
if ($height == null || $height == 0) {
// no height, no width
$height = $h;
}
// miniaturizing
if (!$crop) {
// new size - nw, nh (new width/height)
$scale = $width / $w < $height / $h ? $width / $w : $height / $h;
// smaller rate
$src = array(0, 0, $w, $h);
$dst = array(0, 0, floor($w * $scale), floor($h * $scale));
} else {
// will be cropped
$scale = $width / $w > $height / $h ? $width / $w : $height / $h;
// greater rate
$newW = $width / $scale;
// check the size of in file
$newH = $height / $scale;
// which side is larger (rounding error)
if ($w - $newW > $h - $newH) {
$src = array(floor(($w - $newW) / 2), 0, floor($newW), $h);
} else {
$src = array(0, floor(($h - $newH) / 2), $w, floor($newH));
}
$dst = array(0, 0, floor($width), floor($height));
}
// Watermark - - - - - - - - - - -
if (!empty($watermarkParams) && ($watermarkParams['create'] == 1 || $watermarkParams['create'] == 2)) {
$thumbnailSmall = false;
$thumbnailMedium = false;
$thumbnailLarge = false;
$thumbnailMedium = preg_match("/phoca_thumb_m_/i", $fileOut);
$thumbnailLarge = preg_match("/phoca_thumb_l_/i", $fileOut);
$path = PhocaGalleryPath::getPath();
$fileName = PhocaGalleryFile::getTitleFromFile($fileIn, 1);
// Which Watermark will be used
// If watermark is in current directory use it else use Default
$fileWatermarkMedium = str_replace($fileName, 'watermark-medium.png', $fileIn);
$fileWatermarkLarge = str_replace($fileName, 'watermark-large.png', $fileIn);
clearstatcache();
// Which Watermark will be used
if ($thumbnailMedium) {
if (JFile::exists($fileWatermarkMedium)) {
$fileWatermark = $fileWatermarkMedium;
} else {
if ($watermarkParams['create'] == 2) {
$fileWatermark = $path->image_abs . 'watermark-medium.png';
//.........这里部分代码省略.........
示例9: getCSSPath
public function getCSSPath($type, $rel = 0)
{
$paths = PhocaGalleryPath::getPath();
if ($rel == 1) {
if ($type == 1) {
return $paths->media_css_rel . 'main/';
} else {
return $paths->media_css_rel . 'custom/';
}
} else {
if ($type == 1) {
return JPath::clean($paths->media_css_abs . 'main/');
} else {
return JPath::clean($paths->media_css_abs . 'custom/');
}
}
}
示例10: display
function display($tpl = null)
{
$app = JFactory::getApplication();
// Don't load all the framework if nonsense
$id = $app->input->get('id', 0, 'int');
$this->tagId = $app->input->get('tagid', 0, 'int');
if ($id < 1 && $this->tagId < 1) {
JError::raiseError(404, JText::_("COM_PHOCAGALLERY_CATEGORY_IS_UNPUBLISHED"));
exit;
}
$document = JFactory::getDocument();
$uri = JFactory::getURI();
$menus = $app->getMenu();
$menu = $menus->getActive();
$this->params = $app->getParams();
$this->tmpl['user'] = JFactory::getUser();
$this->tmpl['action'] = $uri->toString();
$this->tmpl['path'] = PhocaGalleryPath::getPath();
$limitStart = $app->input->get('limitstart', 0, 'int');
$this->tmpl['tab'] = $app->input->get('tab', 0, 'int');
$this->tmpl['pl'] = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString());
$this->tmpl['icon_path'] = 'media/com_phocagallery/images/';
$this->tmpl['plcat'] = 'index.php?option=com_phocagallery&view=category';
$this->itemId = $app->input->get('Itemid', 0, 'int');
$neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels();
$access = PhocaGalleryAccess::isAccess($this->tmpl['user']->getAuthorisedViewLevels(), $neededAccessLevels);
// CSS
PhocaGalleryRenderFront::renderAllCSS();
// LIBRARY
$library = PhocaGalleryLibrary::getLibrary();
$libraries['pg-group-shadowbox'] = $library->getLibrary('pg-group-shadowbox');
$libraries['pg-group-highslide'] = $library->getLibrary('pg-group-highslide');
$libraries['pg-group-jak'] = $library->getLibrary('pg-group-jak');
// PARAMS
$this->tmpl['image_categories_size_cv'] = $this->params->get('image_categories_size_cv', 1);
$this->tmpl['display_cat_name_title'] = $this->params->get('display_cat_name_title', 1);
$this->tmpl['display_categories_cv'] = $this->params->get('display_categories_cv', 0);
$this->tmpl['switch_image'] = $this->params->get('switch_image', 0);
$this->tmpl['switch_height'] = $this->params->get('switch_height', 480);
$this->tmpl['switch_width'] = $this->params->get('switch_width', 640);
$this->tmpl['switch_fixed_size'] = $this->params->get('switch_fixed_size', 0);
$this->tmpl['show_page_heading'] = $this->params->get('show_page_heading', 1);
$this->tmpl['phocagallery_width'] = $this->params->get('phocagallery_width', '');
$this->tmpl['phocagallery_center'] = $this->params->get('phocagallery_center', '');
$this->tmpl['imagewidth'] = $this->params->get('medium_image_width', 100);
$this->tmpl['imageheight'] = $this->params->get('medium_image_height', 100);
$this->tmpl['picasa_correct_width_m'] = (int) $this->params->get('medium_image_width', 100);
$this->tmpl['picasa_correct_height_m'] = (int) $this->params->get('medium_image_height', 100);
$this->tmpl['picasa_correct_width_s'] = (int) $this->params->get('small_image_width', 50);
$this->tmpl['picasa_correct_height_s'] = (int) $this->params->get('small_image_height', 50);
$this->tmpl['picasa_correct_width_l'] = (int) $this->params->get('large_image_width', 640);
$this->tmpl['picasa_correct_height_l'] = (int) $this->params->get('large_image_height', 480);
$this->tmpl['category_box_space'] = $this->params->get('category_box_space', 0);
$this->tmpl['detail_window'] = $this->params->get('detail_window', 0);
$this->tmpl['display_name'] = $this->params->get('display_name', 1);
$this->tmpl['display_rating'] = $this->params->get('display_rating', 0);
$this->tmpl['display_rating_img'] = $this->params->get('display_rating_img', 0);
$this->tmpl['display_comment'] = $this->params->get('display_comment', 0);
$this->tmpl['display_comment_img'] = $this->params->get('display_comment_img', 0);
$this->tmpl['display_subcategory'] = $this->params->get('display_subcategory', 1);
$this->tmpl['display_icon_detail'] = $this->params->get('display_icon_detail', 1);
$this->tmpl['display_icon_download'] = $this->params->get('display_icon_download', 2);
$this->tmpl['display_icon_vm'] = $this->params->get('display_icon_vm', 0);
$this->tmpl['display_img_desc_box'] = $this->params->get('display_img_desc_box', 0);
$this->tmpl['diff_thumb_height'] = $this->params->get('diff_thumb_height', 0);
$this->tmpl['overlib_attributes'] = $this->params->get('overlib_attributes', "BELOW, RIGHT, CSSCLASS, TEXTFONTCLASS, 'fontPhocaClass', FGCLASS, 'fgPhocaClass', BGCLASS, 'bgPhocaClass', CAPTIONFONTCLASS,'capfontPhocaClass', CLOSEFONTCLASS, 'capfontclosePhocaClass'");
// Switch image JS
$this->tmpl['basic_image'] = '';
if ($this->tmpl['switch_image'] == 1) {
$this->tmpl['wait_image'] = $this->tmpl['path']->image_rel_front_full . 'icon-switch.gif';
$this->tmpl['basic_image'] = $this->tmpl['path']->image_rel_front_full . 'phoca_thumb_l_no_image.png';
$document->addCustomTag(PhocaGalleryRenderFront::switchImage($this->tmpl['wait_image']));
$basic_imageSelected = 0;
// we have not selected the basic image yet
}
$display_cat_name_breadcrumbs = $this->params->get('display_cat_name_breadcrumbs', 1);
$popup_width = $this->params->get('front_modal_box_width', 680);
$popup_height = $this->params->get('front_modal_box_height', 560);
$this->tmpl['maxuploadchar'] = $this->params->get('max_upload_char', 1000);
$this->tmpl['maxcommentchar'] = $this->params->get('max_comment_char', 1000);
$this->tmpl['maxcreatecatchar'] = $this->params->get('max_create_cat_char', 1000);
$this->tmpl['commentwidth'] = $this->params->get('comment_width', 500);
$this->tmpl['displaycategorygeotagging'] = $this->params->get('display_category_geotagging', 0);
$this->tmpl['displaycategorystatistics'] = $this->params->get('display_category_statistics', 0);
// Used for Highslide JS (only image)
$this->tmpl['displaydescriptiondetail'] = $this->params->get('display_description_detail', 0);
$this->tmpl['display_title_description'] = $this->params->get('display_title_description', 0);
$this->tmpl['charlengthname'] = $this->params->get('char_length_name', 15);
$this->tmpl['char_cat_length_name'] = $this->params->get('char_cat_length_name', 9);
$this->tmpl['display_icon_geo'] = $this->params->get('display_icon_geotagging', 0);
// Check the category
$this->tmpl['display_icon_geoimage'] = $this->params->get('display_icon_geotagging', 0);
// Check the image
$this->tmpl['display_camera_info'] = $this->params->get('display_camera_info', 0);
// PARAMS - Upload
$this->tmpl['multipleuploadchunk'] = $this->params->get('multiple_upload_chunk', 0);
$this->tmpl['displaytitleupload'] = $this->params->get('display_title_upload', 0);
$this->tmpl['displaydescupload'] = $this->params->get('display_description_upload', 0);
$this->tmpl['enablejava'] = $this->params->get('enable_java', -1);
$this->tmpl['enablemultiple'] = $this->params->get('enable_multiple', 0);
//.........这里部分代码省略.........
示例11: onPrepareContent
//.........这里部分代码省略.........
$output .= ' >';
$output .= '<img src="components/com_phocagallery/assets/images/icon-view.' . $tmpl['formaticon'] . '" alt="' . $image->title . '" />';
$output .= '</a>';
}
if ($display_icon_download == 1) {
$output .= ' <a class="' . $button->methodname . '" title="' . JText::_('Image Download') . '" href="' . JRoute::_($image->linkother . '&phocadownload=1') . '"';
// Detail Window
if ($detail_window == 1) {
$output .= ' onclick="' . $buttonOther->options . '"';
} else {
if ($detail_window == 4) {
$output .= ' onclick="' . $tmpl['highslideonclick'] . '"';
} else {
if ($detail_window == 5) {
$output .= ' onclick="' . $tmpl['highslideonclick2'] . '"';
} else {
$output .= ' rel="' . $buttonOther->options . '"';
}
}
}
$output .= ' >';
$output .= '<img src="components/com_phocagallery/assets/images/icon-download.' . $tmpl['formaticon'] . '" alt="' . $image->title . '" />';
$output .= '</a>';
}
$output .= '</div>';
if ($float == '') {
$output .= '<div style="clear:both"> </div>';
}
}
$output .= '</div>';
}
}
//--------------------------
// DISPLAYING OF SWITCHIMAGE
//--------------------------
if ($view == 'switchimage') {
$path = PhocaGalleryPath::getPath();
$waitImage = $path->image_rel . 'icon-switch.gif';
$basicImage = $path->image_rel . 'phoca_thumb_l_no_image.' . $tmpl['formaticon'];
if ($basic_image_id > 0) {
$query = 'SELECT *' . ' FROM #__phocagallery' . ' WHERE id = ' . (int) $basic_image_id;
$db->setQuery($query);
$basicImageArray =& $db->loadObject();
if (isset($basicImageArray->filename)) {
$fileBasicThumb = PhocaGalleryFileThumbnail::getThumbnailName($basicImageArray->filename, 'large');
$basicImage = $fileBasicThumb->rel;
} else {
$basicImage = '';
}
}
$switchHeight = $switch_height;
//$this->switchheight;
$switchCenterH = $switchHeight / 2 - 18;
$switchWidth = $switch_width;
//$this->switchwidth;
$switchCenterW = $switchWidth / 2 - 18;
$document->addCustomTag(PhocaGalleryRenderFront::switchImage($waitImage));
$switchHeight = $switchHeight + 5;
$output .= '<div><center class="main-switch-image" style="margin:0px;padding:7px 5px 7px 5px;margin-bottom:15px;"><table border="0" cellspacing="5" cellpadding="5" style="border:1px solid #c2c2c2;"><tr><td align="center" valign="middle" style="text-align:center;width:' . $switchWidth . 'px;height:' . $switchHeight . 'px; background: url(\'' . JURI::root() . 'components/com_phocagallery/assets/images/icon-switch.gif\') ' . $switchCenterW . 'px ' . $switchCenterH . 'px no-repeat;margin:0px;padding:0px;">
' . JHTML::_('image.site', $basicImage, '', '', '', '', ' id="PhocaGalleryobjectPicture" border="0"') . '
</td></tr></table></center></div>';
} else {
// Overlib
}
//--------------------------
// DISPLAYING OF Clear Both
//--------------------------
if ($view == 'clearboth') {
$output .= '<div style="clear:both"> </div>';
}
if ($view == 'clearright') {
$output .= '<div style="clear:right"> </div>';
}
if ($view == 'clearleft') {
$output .= '<div style="clear:left"> </div>';
}
$output .= '</div>';
if ($float == '') {
$output .= '<div style="clear:both"> </div>';
}
$article->text = preg_replace($regex_all, $output, $article->text, 1);
}
// CUSTOM CSS - For all items it will be the same
if ($libraries['pg-css-sbox-plugin']->value == 0) {
$document->addCustomTag("<style type=\"text/css\">\n" . $cssSbox . "\n" . " </style>\n");
$library->setLibrary('pg-css-sbox-plugin', 1);
}
// All custom CSS tags will be added into one CSS area
if ($libraries['pg-css-pg-plugin']->value == 0) {
$document->addCustomTag("<style type=\"text/css\">\n" . $cssPgPlugin . "\n" . " </style>\n");
$library->setLibrary('pg-css-pg-plugin', 1);
}
if ($libraries['pg-css-ie']->value == 0) {
$document->addCustomTag("<!--[if lt IE 8]>\n<link rel=\"stylesheet\" href=\"" . JURI::base(true) . "/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->");
$library->setLibrary('pg-css-ie', 1);
}
}
// end if count_matches
return true;
}
示例12: display
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->folderstate = $this->get('FolderState');
$this->images = $this->get('Images');
$this->folders = $this->get('Folders');
$this->session = JFactory::getSession();
$this->path = PhocaGalleryPath::getPath();
// Set Default Value
$this->form->setValue('published', '', 1);
$this->form->setValue('approved', '', 1);
$this->form->setValue('language', '', '*');
JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
$params = JComponentHelper::getParams('com_phocagallery');
$this->tmpl['enablethumbcreation'] = $params->get('enable_thumb_creation', 1);
$this->tmpl['enablethumbcreationstatus'] = PhocaGalleryRenderAdmin::renderThumbnailCreationStatus((int) $this->tmpl['enablethumbcreation']);
$this->tmpl['multipleuploadchunk'] = $params->get('multiple_upload_chunk', 0);
$this->tmpl['large_image_width'] = $params->get('large_image_width', 640);
$this->tmpl['large_image_height'] = $params->get('large_image_height', 480);
$this->tmpl['javaboxwidth'] = $params->get('java_box_width', 480);
$this->tmpl['javaboxheight'] = $params->get('java_box_height', 480);
$this->tmpl['uploadmaxsize'] = $params->get('upload_maxsize', 3145728);
$this->tmpl['uploadmaxsizeread'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['uploadmaxsize']);
$this->tmpl['uploadmaxreswidth'] = $params->get('upload_maxres_width', 3072);
$this->tmpl['uploadmaxresheight'] = $params->get('upload_maxres_height', 2304);
$this->tmpl['enablejava'] = $params->get('enable_java', -1);
$this->tmpl['enablemultiple'] = $params->get('enable_multiple', 0);
$this->tmpl['multipleuploadmethod'] = $params->get('multiple_upload_method', 1);
$this->tmpl['multipleresizewidth'] = $params->get('multiple_resize_width', -1);
$this->tmpl['multipleresizeheight'] = $params->get('multiple_resize_height', -1);
$this->currentFolder = '';
if (isset($this->folderstate->folder) && $this->folderstate->folder != '') {
$this->currentFolder = $this->folderstate->folder;
}
// - - - - - - - - - -
//TABS
// - - - - - - - - - -
$this->tmpl['tab'] = JRequest::getVar('tab', '', '', 'string');
$this->tmpl['displaytabs'] = 0;
// UPLOAD
$this->tmpl['currenttab']['upload'] = $this->tmpl['displaytabs'];
$this->tmpl['displaytabs']++;
// MULTIPLE UPLOAD
if ((int) $this->tmpl['enablemultiple'] >= 0) {
$this->tmpl['currenttab']['multipleupload'] = $this->tmpl['displaytabs'];
$this->tmpl['displaytabs']++;
} else {
$this->tmpl['currenttab']['multipleupload'] = 0;
}
// MULTIPLE UPLOAD
if ($this->tmpl['enablejava'] >= 0) {
$this->tmpl['currenttab']['javaupload'] = $this->tmpl['displaytabs'];
$this->tmpl['displaytabs']++;
} else {
$this->tmpl['currenttab']['javaupload'] = 0;
}
// - - - - - - - - - - -
// Upload
// - - - - - - - - - - -
$sU = new PhocaGalleryFileUploadSingle();
$sU->returnUrl = 'index.php?option=com_phocagallery&view=phocagallerym&layout=edit&tab=upload&folder=' . $this->currentFolder;
$sU->tab = 'upload';
$this->tmpl['su_output'] = $sU->getSingleUploadHTML();
$this->tmpl['su_url'] = JURI::base() . 'index.php?option=com_phocagallery&task=phocagalleryu.upload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&viewback=phocagallerym&' . 'folder=' . $this->currentFolder . '&tab=upload';
// - - - - - - - - - - -
// Multiple Upload
// - - - - - - - - - - -
// Get infos from multiple upload
$muFailed = JRequest::getVar('mufailed', '0', '', 'int');
$muUploaded = JRequest::getVar('muuploaded', '0', '', 'int');
$this->tmpl['mu_response_msg'] = $muUploadedMsg = '';
if ($muUploaded > 0) {
$muUploadedMsg = JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded;
}
if ($muFailed > 0) {
$muFailedMsg = JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed;
}
if ($muFailed > 0 && $muUploaded > 0) {
$this->tmpl['mu_response_msg'] = '<div class="alert alert-info">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '<br />' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>';
} else {
if ($muFailed > 0 && $muUploaded == 0) {
$this->tmpl['mu_response_msg'] = '<div class="alert alert-error">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_NOT_UPLOADED_IMG') . ': ' . $muFailed . '</div>';
} else {
if ($muFailed == 0 && $muUploaded > 0) {
$this->tmpl['mu_response_msg'] = '<div class="alert alert-success">' . '<button type="button" class="close" data-dismiss="alert">×</button>' . JText::_('COM_PHOCAGALLERY_COUNT_UPLOADED_IMG') . ': ' . $muUploaded . '</div>';
} else {
$this->tmpl['mu_response_msg'] = '';
}
}
}
if ((int) $this->tmpl['enablemultiple'] >= 0) {
PhocaGalleryFileUploadMultiple::renderMultipleUploadLibraries();
$mU = new PhocaGalleryFileUploadMultiple();
$mU->frontEnd = 0;
$mU->method = $this->tmpl['multipleuploadmethod'];
$mU->url = JURI::base() . 'index.php?option=com_phocagallery&task=phocagalleryu.multipleupload&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=multipleupload&folder=' . $this->currentFolder;
$mU->reload = JURI::base() . 'index.php?option=com_phocagallery&view=phocagallerym&layout=edit&' . $this->session->getName() . '=' . $this->session->getId() . '&' . JSession::getFormToken() . '=1&tab=multipleupload&folder=' . $this->currentFolder;
$mU->maxFileSize = PhocaGalleryFileUploadMultiple::getMultipleUploadSizeFormat($this->tmpl['uploadmaxsize']);
$mU->chunkSize = '1mb';
$mU->imageHeight = $this->tmpl['multipleresizeheight'];
//.........这里部分代码省略.........
示例13: getList
public static function getList($small = 0, $medium = 0, $large = 0, $refreshUrl)
{
static $list;
$params = JComponentHelper::getParams('com_phocagallery');
$clean_thumbnails = $params->get('clean_thumbnails', 0);
// Only process the list once per request
if (is_array($list)) {
return $list;
}
// Get current path from request
$current = JRequest::getVar('folder');
// If undefined, set to empty
if ($current == 'undefined') {
$current = '';
}
//Get folder variables from Helper
$path = PhocaGalleryPath::getPath();
// Initialize variables
if (strlen($current) > 0) {
$origPath = JPath::clean($path->image_abs . $current);
} else {
$origPath = $path->image_abs;
}
$origPathServer = str_replace(DS, '/', $path->image_abs);
$images = array();
$folders = array();
// Get the list of files and folders from the given folder
$fileList = JFolder::files($origPath);
$folderList = JFolder::folders($origPath, '', false, false, array(0 => 'thumbs'));
if (is_array($fileList) && !empty($fileList)) {
natcasesort($fileList);
}
$field = JRequest::getVar('field');
$refreshUrl = $refreshUrl . '&folder=' . $current . '&field=' . $field;
// Iterate over the files if they exist
//file - abc.img, file_no - folder/abc.img
if ($fileList !== false) {
foreach ($fileList as $file) {
$ext = strtolower(JFile::getExt($file));
// Don't display thumbnails from defined files (don't save them into a database)...
$dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($file);
if ($dontCreateThumb == 1) {
$ext = '';
// WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
}
if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') {
if (JFile::exists($origPath . DS . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
//Create thumbnails small, medium, large
$fileNo = $current . "/" . $file;
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileNo, $refreshUrl, $small, $medium, $large);
$tmp = new JObject();
$tmp->name = $fileThumb['name'];
$tmp->nameno = $fileThumb['name_no'];
$tmp->linkthumbnailpath = $fileThumb['thumb_name_m_no_rel'];
$tmp->linkthumbnailpathabs = $fileThumb['thumb_name_m_no_abs'];
$images[] = $tmp;
}
}
}
}
//Clean Thumbs Folder if there are thumbnail files but not original file
if ($clean_thumbnails == 1) {
PhocaGalleryFileFolder::cleanThumbsFolder();
}
// - - - - - - - - - - - -
// Iterate over the folders if they exist
if ($folderList !== false) {
foreach ($folderList as $folder) {
$tmp = new JObject();
$tmp->name = basename($folder);
$tmp->path_with_name = str_replace(DS, '/', JPath::clean($origPath . DS . $folder));
$tmp->path_without_name_relative = $path->image_abs . str_replace($origPathServer, '', $tmp->path_with_name);
$tmp->path_with_name_relative_no = str_replace($origPathServer, '', $tmp->path_with_name);
$folders[] = $tmp;
}
}
$list = array('folders' => $folders, 'Images' => $images);
return $list;
}
示例14: display
function display($tpl = null)
{
if (!JRequest::checkToken('request')) {
$response = array('status' => '0', 'error' => JText::_('JINVALID_TOKEN'));
echo json_encode($response);
return;
}
$app = JFactory::getApplication();
$params = $app->getParams();
$commentValue = $app->input->get('commentValue', '', 'string');
$commentId = $app->input->get('commentId', 0, 'int');
// ID of File
$format = $app->input->get('format', '', 'string');
$task = $app->input->get('task', '', 'string');
$view = $app->input->get('view', '', 'string');
$paramsC = JComponentHelper::getParams('com_phocagallery');
$param['display_comment_img'] = $paramsC->get('display_comment_img', 0);
if ($task == 'refreshcomment' && ((int) $param['display_comment_img'] == 2 || (int) $param['display_comment_img'] == 3)) {
$user =& JFactory::getUser();
//$view = JRequest::getVar( 'view', '', 'get', '', JREQUEST_NOTRIM );
//$Itemid = JRequest::getVar( 'Itemid', 0, '', 'int');
$neededAccessLevels = PhocaGalleryAccess::getNeededAccessLevels();
$access = PhocaGalleryAccess::isAccess($user->getAuthorisedViewLevels(), $neededAccessLevels);
$post['imgid'] = (int) $commentId;
$post['userid'] = $user->id;
$post['comment'] = strip_tags($commentValue);
if ($format != 'json') {
$msg = JText::_('COM_PHOCAGALLERY_ERROR_WRONG_COMMENT');
$response = array('status' => '0', 'error' => $msg);
echo json_encode($response);
return;
}
if ((int) $post['imgid'] < 1) {
$msg = JText::_('COM_PHOCAGALLERY_ERROR_IMAGE_NOT_EXISTS');
$response = array('status' => '0', 'error' => $msg);
echo json_encode($response);
return;
}
$model = $this->getModel();
$checkUserComment = PhocaGalleryCommentImage::checkUserComment($post['imgid'], $post['userid']);
// User has already commented this category
if ($checkUserComment) {
$msg = JText::_('COM_PHOCAGALLERY_COMMENT_ALREADY_SUBMITTED');
$response = array('status' => '0', 'error' => '', 'message' => $msg);
echo json_encode($response);
return;
} else {
if ($access > 0 && $user->id > 0) {
if (!$model->comment($post)) {
$msg = JText::_('COM_PHOCAGALLERY_ERROR_COMMENTING_IMAGE');
$response = array('status' => '0', 'error' => $msg);
echo json_encode($response);
return;
} else {
$o = '<div class="pg-cv-comment-img-box-item">';
$o .= '<div class="pg-cv-comment-img-box-avatar">';
$avatar = PhocaGalleryCommentImage::getUserAvatar($user->id);
$this->tmpl['path'] = PhocaGalleryPath::getPath();
$img = '<div style="width: 20px; height: 20px;"> </div>';
if (isset($avatar->avatar) && $avatar->avatar != '') {
$pathAvatarAbs = $this->tmpl['path']->avatar_abs . 'thumbs' . DS . 'phoca_thumb_s_' . $avatar->avatar;
$pathAvatarRel = $this->tmpl['path']->avatar_rel . 'thumbs/phoca_thumb_s_' . $avatar->avatar;
if (JFile::exists($pathAvatarAbs)) {
$avSize = getimagesize($pathAvatarAbs);
$avRatio = $avSize[0] / $avSize[1];
$avHeight = 20;
$avWidth = 20 * $avRatio;
$img = '<img src="' . JURI::base() . '/' . $pathAvatarRel . '" width="' . $avWidth . '" height="' . $avHeight . '" alt="" />';
}
}
$o .= $img;
$o .= '</div>';
$o .= '<div class="pg-cv-comment-img-box-comment">' . $user->name . ': ' . $post['comment'] . '</div>';
$o .= '<div style="clear:both"></div>';
$o .= '</div>';
$msg = $o . '<br />' . JText::_('COM_PHOCAGALLERY_SUCCESS_COMMENT_SUBMIT');
$response = array('status' => '1', 'error' => '', 'message' => $msg);
echo json_encode($response);
return;
}
} else {
$msg = JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION');
$response = array('status' => '0', 'error' => $msg);
echo json_encode($response);
return;
}
}
} else {
$msg = JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION');
$response = array('status' => '0', 'error' => $msg);
echo json_encode($response);
return;
}
}
示例15: processImages
protected function processImages()
{
if (!empty($this->items)) {
$params = JComponentHelper::getParams('com_phocagallery');
$pagination_thumbnail_creation = $params->get('pagination_thumbnail_creation', 0);
$clean_thumbnails = $params->get('clean_thumbnails', 0);
//Server doesn't have CPU power
//we do thumbnail for all images - there is no pagination...
//or we do thumbanil for only listed images
if (empty($this->items_thumbnail)) {
if ($pagination_thumbnail_creation == 1) {
$this->items_thumbnail = $this->items;
} else {
$this->items_thumbnail = $this->get('ItemsThumbnail');
}
}
// - - - - - - - - - - - - - - - - - - - -
// Check if the file stored in database is on the server. If not please refer to user
// Get filename from every object there is stored in database
// file - abc.img, file_no - folder/abc.img
// Get folder variables from Helper
$path = PhocaGalleryPath::getPath();
$origPath = $path->image_abs;
$origPathServer = str_replace(DS, '/', $path->image_abs);
//-----------------------------------------
//Do all thumbnails no limit no pagination
if (!empty($this->items_thumbnail)) {
foreach ($this->items_thumbnail as $key => $value) {
$fileOriginalThumb = PhocaGalleryFile::getFileOriginal($value->filename);
//Let the user know that the file doesn't exists and delete all thumbnails
if (JFile::exists($fileOriginalThumb)) {
$refreshUrlThumb = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($value->filename, $refreshUrlThumb, 1, 1, 1);
}
}
}
$this->items_thumbnail = null;
// delete data to reduce memory
//Only the the site with limitation or pagination...
if (!empty($this->items)) {
foreach ($this->items as $key => $value) {
$fileOriginal = PhocaGalleryFile::getFileOriginal($value->filename);
//Let the user know that the file doesn't exists and delete all thumbnails
if (!JFile::exists($fileOriginal)) {
$this->items[$key]->filename = JText::_('COM_PHOCAGALLERY_IMG_FILE_NOT_EXISTS');
$this->items[$key]->fileoriginalexist = 0;
} else {
//Create thumbnails small, medium, large
$refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryimgs';
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($value->filename, $refresh_url, 1, 1, 1);
$this->items[$key]->linkthumbnailpath = $fileThumb['thumb_name_s_no_rel'];
$this->items[$key]->fileoriginalexist = 1;
}
}
}
//Clean Thumbs Folder if there are thumbnail files but not original file
if ($clean_thumbnails == 1) {
PhocaGalleryFileFolder::cleanThumbsFolder();
}
}
}