本文整理汇总了PHP中PhocaGalleryFileThumbnail类的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFileThumbnail类的具体用法?PHP PhocaGalleryFileThumbnail怎么用?PHP PhocaGalleryFileThumbnail使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhocaGalleryFileThumbnail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadData
function loadData()
{
if (empty($this->data)) {
$query = 'SELECT a.*' . ' FROM #__phocagallery AS a' . ' WHERE a.id = ' . (int) $this->id;
$this->_db->setQuery($query);
$fileObject = $this->_db->loadObject();
$file = new JObject();
$refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&id=' . (int) $this->id;
//Creata thumbnails if not exist
PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileObject->filename, $refresh_url, 1, 1, 1);
jimport('joomla.filesystem.file');
if (!isset($fileObject->filename)) {
$file->set('linkthumbnailpath', '');
} else {
$thumbFile = PhocaGalleryFileThumbnail::getThumbnailName($fileObject->filename, 'large');
$file->set('linkthumbnailpath', $thumbFile->rel);
$file->set('extid', $fileObject->extid);
$file->set('extl', $fileObject->extl);
$file->set('extw', $fileObject->extw);
$file->set('exth', $fileObject->exth);
}
$this->data = $file;
return (bool) $this->data;
}
return true;
}
示例2: getRealImageSize
function getRealImageSize($filename, $size = 'large', $extLink = 0)
{
phocagalleryimport('phocagallery.file.thumbnail');
if ($extLink == 1) {
list($w, $h, $type) = @getimagesize($filename);
} else {
$thumbName = PhocaGalleryFileThumbnail::getThumbnailName($filename, $size);
list($w, $h, $type) = @getimagesize($thumbName->abs);
}
$size = '';
if (isset($w) && isset($h)) {
$size['w'] = $w;
$size['h'] = $h;
} else {
$size['w'] = 0;
$size['h'] = 0;
}
return $size;
}
示例3: getData
function getData()
{
if (empty($this->_data)) {
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
}
if (!empty($this->_data)) {
foreach ($this->_data as $key => $value) {
$fileOriginal = PhocaGalleryFile::getFileOriginal($value->filename);
//Let the user know that the file doesn't exists
if (!JFile::exists($fileOriginal)) {
$this->_data[$key]->filename = JText::_('COM_PHOCAGALLERY_IMG_FILE_NOT_EXISTS');
$this->_data[$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->_data[$key]->linkthumbnailpath = $fileThumb['thumb_name_s_no_rel'];
$this->_data[$key]->fileoriginalexist = 1;
}
}
}
return $this->_data;
}
示例4: createFileThumbnail
function createFileThumbnail($fileOriginal, $fileThumbnail, $size, $frontUpload = 0, &$errorMsg)
{
$paramsC = JComponentHelper::getParams('com_phocagallery');
$enable_thumb_creation = $paramsC->get('enable_thumb_creation', 1);
$watermarkParams['create'] = $paramsC->get('create_watermark', 0);
// Watermark
$watermarkParams['x'] = $paramsC->get('watermark_position_x', 'center');
$watermarkParams['y'] = $paramsC->get('watermark_position_y', 'middle');
$crop_thumbnail = $paramsC->get('crop_thumbnail', 5);
// Crop or not
$crop = null;
switch ($size) {
case 'small1':
case 'small2':
case 'small3':
case 'medium1':
case 'medium2':
case 'medium3':
$crop = 1;
break;
case 'small':
if ($crop_thumbnail == 3 || $crop_thumbnail == 5 || $crop_thumbnail == 6 || $crop_thumbnail == 7) {
$crop = 1;
}
break;
case 'medium':
if ($crop_thumbnail == 2 || $crop_thumbnail == 4 || $crop_thumbnail == 5 || $crop_thumbnail == 7) {
$crop = 1;
}
break;
case 'large':
default:
if ($crop_thumbnail == 1 || $crop_thumbnail == 4 || $crop_thumbnail == 6 || $crop_thumbnail == 7) {
$crop = 1;
}
break;
}
// disable or enable the thumbnail creation
if ($enable_thumb_creation == 1) {
$fileResize = PhocaGalleryFileThumbnail::getThumbnailResize($size);
if (JFile::exists($fileOriginal)) {
//file doesn't exist, create thumbnail
if (!JFile::exists($fileThumbnail)) {
$errorMsg = 'Error4';
//Don't do thumbnail if the file is smaller (width, height) than the possible thumbnail
list($width, $height) = GetImageSize($fileOriginal);
//larger
phocagalleryimport('phocagallery.image.imagemagic');
if ($width > $fileResize['width'] || $height > $fileResize['height']) {
$imageMagic = PhocaGalleryImageMagic::imageMagic($fileOriginal, $fileThumbnail, $fileResize['width'], $fileResize['height'], $crop, null, $watermarkParams, $frontUpload, $errorMsg);
} else {
$imageMagic = PhocaGalleryImageMagic::imageMagic($fileOriginal, $fileThumbnail, $width, $height, $crop, null, $watermarkParams, $frontUpload, $errorMsg);
}
if ($imageMagic) {
return true;
} else {
return false;
// error Msg will be taken from imageMagic
}
} else {
$errorMsg = 'ThumbnailExists';
//thumbnail exists
return false;
}
} else {
$errorMsg = 'ErrorFileOriginalNotExists';
return false;
}
$errorMsg = 'Error3';
return false;
} else {
$errorMsg = 'DisabledThumbCreation';
// User have disabled the thumbanil creation e.g. because of error
return false;
}
}
示例5: explode
} else {
$fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($this->item->filename, '', 0, 0, 0);
$this->item->linkthumbnailpath = $fileThumb['thumb_name_m_no_rel'];
$this->item->fileoriginalexist = 1;
}
echo '<div style="float:right;margin:5px;">';
// PICASA
if (isset($this->item->extid) && $this->item->extid != '') {
$resW = explode(',', $this->item->extw);
$resH = explode(',', $this->item->exth);
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($resW[2], $resH[2], 100, 100);
$imgLink = $this->item->extl;
echo '<img class="img-polaroid" src="' . $this->item->exts . '" width="' . $correctImageRes['width'] . '" height="' . $correctImageRes['height'] . '" alt="" />';
} else {
if (isset($this->item->fileoriginalexist) && $this->item->fileoriginalexist == 1) {
$imageRes = PhocaGalleryImage::getRealImageSize($this->item->filename, 'medium');
//$correctImageRes = PhocaGalleryImage::correctSizeWithRate($imageRes['w'], $imageRes['h'], 100, 100);
$imgLink = PhocaGalleryFileThumbnail::getThumbnailName($this->item->filename, 'large');
// TODO check the image
echo '<img class="img-polaroid" style="max-width:100px;" src="' . JURI::root() . $this->item->linkthumbnailpath . '?imagesid=' . md5(uniqid(time())) . '" alt="" />' . '</a>';
} else {
}
}
echo '</div>';
echo '</div>';
//end span2
echo $r->formInputs();
echo $r->endForm();
?>
示例6: _singleFileUploadAvatar
function _singleFileUploadAvatar(&$errUploadMsg, $file, &$redirectUrl)
{
$app = JFactory::getApplication();
JRequest::checkToken('request') or jexit('Invalid Token');
jimport('joomla.client.helper');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
$path = PhocaGalleryPath::getPath();
$format = JRequest::getVar('format', 'html', '', 'cmd');
$return = JRequest::getVar('return-url', null, 'post', 'base64');
$viewBack = JRequest::getVar('viewback', '', '', '');
$view = JRequest::getVar('view', '', 'get', '', JREQUEST_NOTRIM);
$paramsC = JComponentHelper::getParams('com_phocagallery');
$limitStartUrl = $this->getLimitStartUrl(0, 'subcat');
$return = JRoute::_($this->_url . $limitStartUrl->subcat . $limitStartUrl->image, false);
$enableUploadAvatar = (int) $paramsC->get('enable_upload_avatar', 1);
if ($enableUploadAvatar != 1) {
$errUploadMsg = JText::_('COM_PHOCAGALLERY_NOT_ABLE_UPLOAD_AVATAR');
$redirectUrl = $return;
return false;
}
if (isset($file['name'])) {
$fileAvatar = md5(uniqid(time())) . '.' . JFile::getExt($file['name']);
$filepath = JPath::clean($path->avatar_abs . DS . $fileAvatar);
if (!PhocaGalleryFileUpload::canUpload($file, $errUploadMsg)) {
if ($errUploadMsg == 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE') {
$errUploadMsg = JText::_($errUploadMsg) . ' (' . PhocaGalleryFile::getFileSizeReadable($file['size']) . ')';
} else {
if ($errUploadMsg == 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGERESOLUTION') {
$imgSize = PhocaGalleryImage::getImageSize($file['tmp_name']);
$errUploadMsg = JText::_($errUploadMsg) . ' (' . (int) $imgSize[0] . ' x ' . (int) $imgSize[1] . ' px)';
} else {
$errUploadMsg = JText::_($errUploadMsg);
}
}
$redirectUrl = $return;
return false;
}
if (!JFile::upload($file['tmp_name'], $filepath)) {
$errUploadMsg = JText::_('COM_PHOCAGALLERY_FILE_UNABLE_UPLOAD');
$redirectUrl = $return;
return false;
} else {
$redirectUrl = $return;
//Create thumbnail small, medium, large (Delete previous before)
PhocaGalleryFileThumbnail::deleteFileThumbnail('avatars/' . $fileAvatar, 1, 1, 1);
$returnFrontMessage = PhocaGalleryFileThumbnail::getOrCreateThumbnail('avatars/' . $fileAvatar, $return, 1, 1, 1, 1);
if ($returnFrontMessage != 'Success') {
$errUploadMsg = JText::_('COM_PHOCAGALLERY_THUMBNAIL_AVATAR_NOT_CREATED');
return false;
}
// Saving file name into database with relative path
$succeeded = false;
PhocaGalleryControllerUser::saveUser($fileAvatar, $succeeded, $errUploadMsg);
$redirectUrl = $return;
return $succeeded;
}
} else {
$errUploadMsg = JText::_('COM_PHOCAGALLERY_WARNING_FILETYPE');
$redirectUrl = $return;
return false;
}
return false;
}
示例7: 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;
}
示例8: onContentPrepare
//.........这里部分代码省略.........
} else {
if ($plugin_type == 2) {
$image->extw = $extw[0];
//large
} else {
$image->extw = $extw[1];
//medium
}
}
$image->extwswitch = $extw[0];
//used for correcting switch
}
if ($image->exth != '') {
$exth = explode(',', $image->exth);
if ($plugin_type == 1) {
$image->exth = $exth[2];
//small
} else {
if ($plugin_type == 2) {
$image->exth = $exth[0];
//large
} else {
$image->exth = $exth[1];
//medium
}
}
$image->exthswitch = $exth[0];
//used for correcting switch
}
// - - - - - - - - -
$image->slug = $image->id . '-' . $image->alias;
// Get file thumbnail or No Image
$image->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($image->filename, $imgSize);
$file_thumbnail = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, $imgSize);
$image->linkthumbnailpathabs = $file_thumbnail->abs;
// ROUTE
//$siteLink = JRoute::_(PhocaGalleryRoute::getImageRoute($image->id, $image->catid, $image->alias, $image->catalias, 'detail', 'tmpl=component&detail='.$tmpl['detail_window'].'&buttons='.$detail_buttons );
// Different links for different actions: image, zoom icon, download icon
$thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'large');
$thumbLinkM = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'medium');
// ROUTE
if ($tmpl['detail_window'] == 7) {
$suffix = 'detail=' . $tmpl['detail_window'] . '&buttons=' . $detail_buttons;
} else {
$suffix = 'tmpl=component&detail=' . $tmpl['detail_window'] . '&buttons=' . $detail_buttons;
}
$siteLink = JRoute::_(PhocaGalleryRoute::getImageRoute($image->id, $image->catid, $image->alias, $image->catalias, 'detail', $suffix));
$imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($image->filename, 1);
$imgLink = $thumbLink->rel;
if (isset($image->extid) && $image->extid != '') {
$imgLink = $image->extl;
$imgLinkOrig = $image->exto;
}
// Different Link - to all categories
if ((int) $tmpl['pluginlink'] == 2) {
$siteLink = $imgLinkOrig = $imgLink = PhocaGalleryRoute::getCategoriesRoute();
} else {
if ((int) $tmpl['pluginlink'] == 1) {
$siteLink = $imgLinkOrig = $imgLink = PhocaGalleryRoute::getCategoryRoute($image->catid, $image->catalias);
}
}
if ($tmpl['detail_window'] == 2) {
$image->link = $imgLink;
$image->link2 = $imgLink;
$image->linkother = $siteLink;
$image->linkorig = $imgLinkOrig;
示例9: store
function store($data, $return)
{
//If this file doesn't exists don't save it
if (!PhocaGalleryFile::existsFileOriginal($data['filename'])) {
$this->setError('File not exists');
return false;
}
$data['imgorigsize'] = PhocaGalleryFile::getFileSize($data['filename'], 0);
//If there is no title and no alias, use filename as title and alias
if (!isset($data['title']) || isset($data['title']) && $data['title'] == '') {
$data['title'] = PhocaGalleryFile::getTitleFromFile($data['filename']);
}
if (!isset($data['alias']) || isset($data['alias']) && $data['alias'] == '') {
$data['alias'] = PhocaGalleryFile::getTitleFromFile($data['filename']);
}
//clean alias name (no bad characters)
//$data['alias'] = PhocaGalleryText::getAliasName($data['alias']);
if (!isset($data['longitude']) || isset($data['longitude']) && $data['longitude'] == '' || (!isset($data['latitude']) || isset($data['latitude']) && $data['latitude'] == '')) {
phocagalleryimport('phocagallery.geo.geo');
$coords = PhocaGalleryGeo::getGeoCoords($data['filename']);
if (!isset($data['longitude']) || isset($data['longitude']) && $data['longitude'] == '') {
$data['longitude'] = $coords['longitude'];
}
if (!isset($data['latitude']) || isset($data['latitude']) && $data['latitude'] == '') {
$data['latitude'] = $coords['latitude'];
}
if ((!isset($data['zoom']) || isset($data['zoom']) && $data['zoom'] == '') && $data['longitude'] != '' && $data['latitude'] != '') {
$data['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
}
}
$row =& $this->getTable('phocagallery', 'Table');
// Bind the form fields to the Phoca gallery table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Create the timestamp for the date
$row->date = gmdate('Y-m-d H:i:s');
// if new item, order last in appropriate group
if (!$row->id) {
$where = 'catid = ' . (int) $row->catid;
$row->ordering = $row->getNextOrder($where);
}
// Make sure the Phoca gallery table is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the Phoca gallery table to the database
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
//Create thumbnail small, medium, large
$returnFrontMessage = PhocaGalleryFileThumbnail::getOrCreateThumbnail($row->filename, $return, 1, 1, 1, 1);
if ($returnFrontMessage == 'Success') {
return true;
} else {
return false;
}
}
示例10: getMosaicFields
public function getMosaicFields($a, $images, $size = 0, $extImg = 0, $w = 100, $h = 100)
{
if ($size == 1) {
$i0 = 'medium';
// |
$i1 = 'medium1';
// ||
$i2 = 'medium2';
// --
$i3 = 'medium3';
// ||--
} else {
$i0 = 'small';
// |
$i1 = 'small1';
// ||
$i2 = 'small2';
// --
$i3 = 'small3';
// ||--
}
$o = array();
switch ($a) {
case 1:
if ($extImg == 1) {
$o['w'] = (int) $w * 3;
$o['h'] = (int) $h;
$o['w1'] = (int) $w * 2;
$o['w2'] = (int) $w;
$wi = $w * 2;
$hi = $h * 2;
$attr = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$wi = $w;
$hi = $h;
$attr1 = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$o['b1'] = '<span class="pg-multi-img"><img src="' . $images[0]->extm . '" ' . $attr . ' alt="" /></span>';
$o['b2'] = '<span class="pg-multi-img"><img src="' . $images[0]->extm . '" ' . $attr1 . ' alt="" /></span>';
} else {
$t = PhocaGalleryFileThumbnail::getThumbnailName($images[0]->filename, $i3);
$i[0][0] = $t->rel;
$t = PhocaGalleryFileThumbnail::getThumbnailName($images[0]->filename, $i0);
$iS = getimagesize($t->abs);
$i[1][0] = $t->rel;
$i[1][1] = $iS[0];
$i[1][2] = $iS[1];
$o['w'] = (int) $i[1][1] * 3;
$o['h'] = (int) $i[1][2];
$o['w1'] = (int) $i[1][1] * 2;
$o['w2'] = (int) $i[1][1];
$o['b1'] = '<span class="pg-multi-img"><img src="' . JURI::base(true) . '/' . $i[0][0] . '" alt="" /></span>';
$o['b2'] = '<span class="pg-multi-img"><img src="' . JURI::base(true) . '/' . $i[1][0] . '" alt="" /></span>';
}
return $o;
break;
case 2:
if ($extImg == 1) {
$o['w'] = (int) $w * 3;
$o['h'] = (int) $h;
$o['w1'] = (int) $w * 2;
$o['w2'] = (int) $w;
$wi = $w * 2;
$hi = $h * 2;
$attr = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$wi = $w;
$hi = $h * 2;
$attr1 = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$o['b1'] = '<span class="pg-multi-img"><img src="' . $images[0]->extm . '" ' . $attr . ' alt="" /></span>';
$o['b2'] = '<span class="pg-multi-img"><img src="' . $images[1]->extm . '" ' . $attr1 . ' alt="" /></span>';
} else {
$t = PhocaGalleryFileThumbnail::getThumbnailName($images[0]->filename, $i3);
$i[0][0] = $t->rel;
$t = PhocaGalleryFileThumbnail::getThumbnailName($images[1]->filename, $i1);
$iS = getimagesize($t->abs);
$i[1][0] = $t->rel;
$i[1][1] = $iS[0];
$i[1][2] = $iS[1];
$o['w'] = (int) $i[1][1] * 3;
$o['h'] = (int) $i[1][2];
$o['w1'] = (int) $i[1][1] * 2;
$o['w2'] = (int) $i[1][1];
$o['b1'] = '<span class="pg-multi-img"><img src="' . JURI::base(true) . '/' . $i[0][0] . '" alt="" /></span>';
$o['b2'] = '<span class="pg-multi-img"><img src="' . JURI::base(true) . '/' . $i[1][0] . '" alt="" /></span>';
}
return $o;
break;
case 3:
if ($extImg == 1) {
$o['w'] = (int) $w * 3;
$o['h'] = (int) $h * 2;
$o['w1'] = (int) $w * 2;
$o['w2'] = (int) $w;
$wi = $w * 2;
$hi = $h * 2;
$attr = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$wi = $w;
$hi = $h;
$attr1 = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$attr2 = 'style="width:' . $wi . 'px;height:' . $hi . 'px"';
$o['b1'] = '<span class="pg-multi-img"><img src="' . $images[0]->extm . '" ' . $attr . ' alt="" /></span>';
$o['b2'] = '<span class="pg-multi-img"><img src="' . $images[1]->extm . '" ' . $attr1 . ' alt="" /></span>' . '<span class="pg-multi-img"><img src="' . $images[2]->extm . '" ' . $attr2 . ' alt="" /></span>';
//.........这里部分代码省略.........
示例11: deletethumbs
function deletethumbs($id)
{
if ($id > 0) {
$query = 'SELECT a.filename as filename' . ' FROM #__phocagallery AS a' . ' WHERE a.id = ' . (int) $id;
$this->_db->setQuery($query);
$file = $this->_db->loadObject();
if (isset($file->filename) && $file->filename != '') {
$deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($file->filename, 1, 1, 1);
if ($deleteThubms) {
return true;
} else {
return false;
}
}
return false;
}
return false;
}
示例12: onPrepareContent
//.........这里部分代码省略.........
if ($limitcount > 0) {
$limit = ' LIMIT ' . $limitstart . ', ' . $limitcount;
}
$query = 'SELECT *' . ' FROM #__phocagallery' . ' WHERE catid = ' . (int) $catid . ' AND published = 1' . $where . ' ORDER BY ordering' . $limit;
$db->setQuery($query);
$category =& $db->loadObjectList();
// current category info
$query = 'SELECT c.*,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as slug ' . ' FROM #__phocagallery_categories AS c' . ' WHERE c.id = ' . (int) $catid;
// ' AND c.section = "com_phocagallery"';
$db->setQuery($query, 0, 1);
$category_info = $db->loadObject();
// Output
foreach ($category as $image) {
// PicLens CATEGORY - loaded every time new category will be displayed on the site---------
if ((int) $enable_piclens > 0) {
$libName = 'pg-piclens-' . $image->catid;
$libraries[$libName] = $library->getLibrary($libName);
if ($libraries[$libName]->value == 0) {
$document->addCustomTag("<link id=\"phocagallerypiclens\" rel=\"alternate\" href=\"" . JURI::base(true) . "/images/phocagallery/" . $image->catid . ".rss\" type=\"application/rss+xml\" title=\"\" />");
$library->setLibrary($libName, 1);
}
// PicLens CSS - will be loaded only one time per site
$libraries[$libName] = $library->getLibrary('pg-pl-piclens');
if ($libraries['pg-pl-piclens']->value == 0) {
$document->addScript('http://lite.piclens.com/current/piclens.js');
$document->addCustomTag("<style type=\"text/css\">\n" . " .mbf-item { display: none; }\n" . " #phocagallery .mbf-item { display: none; }\n" . " </style>\n");
$library->setLibrary('pg-pl-piclens', 1);
}
}
// END PICLENS -----------------------------------------------------------------------------
$image->slug = $image->id . '-' . $image->alias;
// Get file thumbnail or No Image
$image->linkthumbnailpath = PhocaGalleryImageFront::displayImageOrNoImage($image->filename, 'medium');
$file_thumbnail = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'medium');
$image->linkthumbnailpathabs = $file_thumbnail->abs;
// -------------------------------------------------------------- SEF PROBLEM
// Is there a Itemid for category
$items = $menu->getItems('link', 'index.php?option=com_phocagallery&view=category&id=' . $category_info->id);
$itemscat = $menu->getItems('link', 'index.php?option=com_phocagallery&view=categories');
if (isset($itemscat[0])) {
$itemid = $itemscat[0]->id;
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category_info->slug . '&id=' . $image->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons);
} else {
if (isset($items[0])) {
$itemid = $items[0]->id;
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category_info->slug . '&id=' . $image->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons);
} else {
$itemid = 0;
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category_info->slug . '&id=' . $image->slug . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons);
}
}
// ---------------------------------------------------------------------------------
// Different links for different actions: image, zoom icon, download icon
$thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'large');
$imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($image->filename, 1);
$imgLink = $thumbLink->rel;
if ($detail_window == 2) {
$image->link = $imgLink;
$image->link2 = $imgLink;
$image->linkother = $siteLink;
$image->linkorig = $imgLinkOrig;
} else {
if ($detail_window == 3) {
$image->link = $imgLink;
$image->link2 = $imgLink;
$image->linkother = $siteLink;
示例13: cooliris
function cooliris($cids, &$message)
{
$db = JFactory::getDBO();
$path = PhocaGalleryPath::getPath();
$piclensImg = $path->image_rel_front . 'icon-phocagallery.png';
$paramsC = JComponentHelper::getParams('com_phocagallery');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
// PARAMS
// original 0, thumbnail 1
$cooliris_image = $paramsC->get('piclens_image', 1);
if (JFolder::exists($path->image_abs)) {
foreach ($cids as $kcid => $vcid) {
$xml = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>' . "\n";
$xml .= '<rss xmlns:media="http://search.yahoo.com/mrss" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">' . "\n";
$xml .= ' <channel>' . "\n";
$xml .= ' <atom:icon>' . JURI::root() . $piclensImg . '</atom:icon>' . "\n\n";
$xml .= ' <title>Phoca Gallery</title>' . "\n";
$xml .= ' <link>http://www.phoca.cz/</link>' . "\n";
$xml .= ' <description>Phoca Gallery</description>' . "\n";
$query = 'SELECT a.id, a.title, a.filename, a.description, a.extid, a.extl, a.exto' . ' FROM #__phocagallery AS a' . ' WHERE a.catid = ' . (int) $vcid . ' AND a.published = 1' . ' ORDER BY a.catid, a.ordering';
$db->setQuery($query);
$rows = $db->loadObjectList();
foreach ($rows as $krow => $vrow) {
$file = PhocaGalleryFileThumbnail::getOrCreateThumbnail($vrow->filename, '');
$thumbFile = str_replace("administrator", "", $file['thumb_name_l_no_rel']);
$origFile = str_replace("administrator", "", $file['name_original_rel']);
$xml .= ' <item>' . "\n";
$xml .= ' <title>' . $vrow->title . '</title>' . "\n";
if ($vrow->extid != '') {
$xml .= '<link>' . $vrow->extl . '</link>' . "\n";
} else {
$xml .= ' <link>' . JURI::root() . $thumbFile . '</link>' . "\n";
}
$xml .= ' <description>' . JFilterOutput::cleanText(strip_tags($vrow->description)) . '</description>' . "\n";
if ($vrow->extid != '') {
$xml .= ' <media:thumbnail url="' . $vrow->extl . '" />' . "\n";
if ($cooliris_image == 1) {
$xml .= ' <media:content url="' . $vrow->extl . '" />' . "\n";
} else {
$xml .= ' <media:content url="' . $vrow->exto . '" />' . "\n";
}
} else {
$xml .= ' <media:thumbnail url="' . JURI::root() . $thumbFile . '" />' . "\n";
if ($cooliris_image == 1) {
$xml .= ' <media:content url="' . JURI::root() . $thumbFile . '" />' . "\n";
} else {
$xml .= ' <media:content url="' . JURI::root() . $origFile . '" />' . "\n";
}
}
if ($vrow->extid != '') {
$xml .= ' <guid isPermaLink="false">' . $vcid . '-phocagallerypiclenscode-' . $vrow->extid . '</guid>' . "\n";
} else {
$xml .= ' <guid isPermaLink="false">' . $vcid . '-phocagallerypiclenscode-' . $vrow->filename . '</guid>' . "\n";
}
$xml .= ' </item>' . "\n\n";
}
$xml .= ' </channel>' . "\n";
$xml .= '</rss>' . "\n";
ob_start();
echo $xml;
$xmlToWrite = ob_get_contents();
ob_end_clean();
if (!JFile::write($path->image_abs . DS . $vcid . '.rss', $xmlToWrite)) {
$message = 'COM_PHOCAGALLERY_ERROR_SAVING_RSS';
return false;
}
}
return true;
} else {
$message = 'COM_PHOCAGALLERY_ERROR_IMAGE_FOLDER_NOT_EXIST';
return false;
}
}
示例14: display
//.........这里部分代码省略.........
$items[$iS]->extwswitch = $extw[0];
}
if ($items[$iS]->exth != '') {
$exth = explode(',', $items[$iS]->exth);
$items[$iS]->exth = $exth[1];
$items[$iS]->exthswitch = $exth[0];
}
$items[$iS]->extpic = 1;
$items[$iS]->linkthumbnailpath = '';
} else {
$items[$iS]->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($items[$iS]->filename, 'medium');
}
if (isset($parentCategory->params)) {
$items[$iS]->parentcategoryparams = $parentCategory->params;
}
// Add the first Image as basic image
if ($this->tmpl['switchimage'] == 1) {
if ($basicImageSelected == 0) {
if ((int) $this->tmpl['switchwidth'] > 0 && (int) $this->tmpl['switchheight'] > 0 && $this->tmpl['switchfixedsize'] == 1) {
$wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0', 'width' => $this->tmpl['switchwidth'], 'height' => $this->tmpl['switchheight']);
$wHString = ' id="PhocaGalleryobjectPicture" border="0" width="' . $this->tmpl['switchwidth'] . '" height="' . $this->tmpl['switchheight'] . '"';
} else {
$wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0');
$wHString = ' id="PhocaGalleryobjectPicture" border="0"';
}
if (isset($items[$iS]->extpic) && $items[$iS]->extpic != '') {
$this->tmpl['basicimage'] = JHtml::_('image', $items[$iS]->extl, '', $wHArray);
} else {
$this->tmpl['basicimage'] = JHtml::_('image', str_replace('phoca_thumb_m_', 'phoca_thumb_l_', $items[$iS]->linkthumbnailpath), '', $wHString);
}
$basicImageSelected = 1;
}
}
$thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($items[$iS]->filename, 'large');
$thumbLinkM = PhocaGalleryFileThumbnail::getThumbnailName($items[$iS]->filename, 'medium');
$imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($items[$iS]->filename, 1);
if ($this->tmpl['detailwindow'] == 7) {
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $items[$iS]->catslug . '&id=' . $items[$iS]->slug . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'));
} else {
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $items[$iS]->catslug . '&id=' . $items[$iS]->slug . '&tmpl=component' . '&Itemid=' . JRequest::getVar('Itemid', 0, '', 'int'));
}
$imgLink = $thumbLink->rel;
if ($extImage) {
$imgLink = $items[$iS]->extl;
$imgLinkOrig = $items[$iS]->exto;
}
// Detail Window
if ($this->tmpl['detailwindow'] == 2) {
$items[$iS]->link = $imgLink;
$items[$iS]->link2 = $imgLink;
$items[$iS]->linkother = $imgLink;
$items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detailwindow'] == 3) {
$items[$iS]->link = $imgLink;
$items[$iS]->link2 = $imgLink;
$items[$iS]->linkother = $siteLink;
$items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detailwindow'] == 5) {
$items[$iS]->link = $imgLink;
$items[$iS]->link2 = $siteLink;
$items[$iS]->linkother = $siteLink;
$items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detailwindow'] == 6) {
示例15: getJsSlideshow
public function getJsSlideshow($catid, $id, $slideshow = 0, $catidSlug, $idSlug)
{
jimport('joomla.filesystem.file');
phocagalleryimport('phocagallery.file.filethumbnail');
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$params = $app->getParams();
//$image_ordering = $params->get( 'image_ordering', 1 );
//$imageOrdering = PhocaGalleryOrdering::getOrderingString($image_ordering);
$detailWindow = $params->get('detail_window', 0);
if ($detailWindow == 7) {
$tmplCom = '';
} else {
$tmplCom = '&tmpl=component';
}
// 1. GET DATA FOR JAVASCRIPT
$jsSlideshowData['files'] = '';
//Get filename of all photos
$query = 'SELECT a.id, a.filename, a.extl, a.description' . ' FROM #__phocagallery AS a' . ' LEFT JOIN #__phocagallery_img_votes_statistics AS r ON r.imgid = a.id' . ' WHERE a.catid=' . (int) $catid . ' AND a.published = 1 AND a.approved = 1' . $this->_imgordering['output'];
$db->setQuery($query);
$filenameAll = $db->loadObjectList();
$countImg = 0;
$endComma = ',';
if (!empty($filenameAll)) {
$countFilename = count($filenameAll);
foreach ($filenameAll as $key => $value) {
$countImg++;
if ($countImg == $countFilename) {
$endComma = '';
}
$filterTags = '';
$filterAttrs = '';
$filter = new JFilterInput($filterTags, $filterAttrs, 1, 1, 1);
$description = $filter->clean(PhocaGalleryText::strTrimAll($value->description), 'html');
$description = addslashes($value->description);
$description = trim($description);
$description = str_replace("\n", '', $description);
$description = str_replace("\r", '', $description);
if (isset($value->extl) && $value->extl != '') {
$jsSlideshowData['files'] .= '["' . $value->extl . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$fileThumbnail = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'large');
$imgLink = JURI::base(true) . '/' . $fileThumbnail->rel;
if (JFile::exists($fileThumbnail->abs)) {
$jsSlideshowData['files'] .= '["' . $imgLink . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$fileThumbnail = JURI::base(true) . '/' . "media/com_phocagallery/images/phoca_thumb_l_no_image.png";
$jsSlideshowData['files'] .= '["' . $fileThumbnail . '", "", "", ""]' . $endComma . "\n";
}
}
}
}
// 2. GET DATA FOR DISPLAYING SLIDESHOW BUTTONS
//We can display slideshow option if there is more than one foto
//But in database there can be more photos - more rows but if file is in db but it doesn't exist, we don't count it
//$countImg = SQLQuery::selectOne($mdb2, "SELECT COUNT(*) FROM $db_gallery WHERE siteid=$id");
if ($countImg > 1) {
//Data from GET['COM_PHOCAGALLERY_SLIDESHOW']
if ($slideshow == 1) {
$jsSlideshowData['icons'] = '<div class="pg-imgbgd">' . '<a href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $catidSlug . '&id=' . $idSlug . $tmplCom . '&phocaslideshow=0' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int')) . '" title="' . JText::_('COM_PHOCAGALLERY_STOP_SLIDESHOW') . '" >' . JHTML::_('image', 'media/com_phocagallery/images/icon-stop.png', JText::_('COM_PHOCAGALLERY_STOP_SLIDESHOW')) . '</a></div>' . '</td><td align="center">' . JHTML::_('image', 'media/com_phocagallery/images/icon-play-grey.png', JText::_('COM_PHOCAGALLERY_START_SLIDESHOW'));
} else {
$jsSlideshowData['icons'] = JHTML::_('image', 'media/com_phocagallery/images/icon-stop-grey.png', JText::_('COM_PHOCAGALLERY_STOP_SLIDESHOW')) . '</td><td align="center">' . '<div class="pg-imgbgd">' . '<a href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $catidSlug . '&id=' . $idSlug . '&phocaslideshow=1' . $tmplCom . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int')) . '" title="' . JText::_('COM_PHOCAGALLERY_START_SLIDESHOW') . '">' . JHTML::_('image', 'media/com_phocagallery/images/icon-play.png', JText::_('COM_PHOCAGALLERY_START_SLIDESHOW')) . '</a></div>';
}
} else {
$jsSlideshowData['icons'] = '';
}
return $jsSlideshowData;
//files (javascript) and icons (buttons)
}