本文整理汇总了PHP中PhocaGalleryFileThumbnail::getThumbnailName方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFileThumbnail::getThumbnailName方法的具体用法?PHP PhocaGalleryFileThumbnail::getThumbnailName怎么用?PHP PhocaGalleryFileThumbnail::getThumbnailName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhocaGalleryFileThumbnail
的用法示例。
在下文中一共展示了PhocaGalleryFileThumbnail::getThumbnailName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: tdImage
public function tdImage($item, $button, $txtE, $class = '', $avatarAbs = '', $avatarRel = '')
{
$o = '<td class="' . $class . '">' . "\n";
$o .= '<div class="phocagallery-box-file">' . "\n" . ' <center>' . "\n" . ' <div class="phocagallery-box-file-first">' . "\n" . ' <div class="phocagallery-box-file-second">' . "\n" . ' <div class="phocagallery-box-file-third">' . "\n" . ' <center>' . "\n";
if ($avatarAbs != '' && $avatarRel != '') {
// AVATAR
if (JFile::exists($avatarAbs . $item->avatar)) {
$o .= '<a class="' . $button->modalname . '"' . ' title="' . $button->text . '"' . ' href="' . JURI::root() . $avatarRel . $item->avatar . '" ' . ' rel="' . $button->options . '" >' . '<img src="' . JURI::root() . $avatarRel . $item->avatar . '?imagesid=' . md5(uniqid(time())) . '" alt="' . JText::_($txtE) . '" />' . '</a>';
} else {
$o .= JHTML::_('image', '/media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
}
} else {
// PICASA
if (isset($item->extid) && $item->extid != '') {
$resW = explode(',', $item->extw);
$resH = explode(',', $item->exth);
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($resW[2], $resH[2], 50, 50);
$imgLink = $item->extl;
$o .= '<a class="' . $button->modalname . '" title="' . $button->text . '" href="' . $imgLink . '" rel="' . $button->options . '" >' . '<img src="' . $item->exts . '?imagesid=' . md5(uniqid(time())) . '" width="' . $correctImageRes['width'] . '" height="' . $correctImageRes['height'] . '" alt="' . JText::_($txtE) . '" />' . '</a>' . "\n";
} else {
if (isset($item->fileoriginalexist) && $item->fileoriginalexist == 1) {
$imageRes = PhocaGalleryImage::getRealImageSize($item->filename, 'small');
$correctImageRes = PhocaGalleryImage::correctSizeWithRate($imageRes['w'], $imageRes['h'], 50, 50);
$imgLink = PhocaGalleryFileThumbnail::getThumbnailName($item->filename, 'large');
$o .= '<a class="' . $button->modalname . '" title="' . $button->text . '" href="' . JURI::root() . $imgLink->rel . '" rel="' . $button->options . '" >' . '<img src="' . JURI::root() . $item->linkthumbnailpath . '?imagesid=' . md5(uniqid(time())) . '" width="' . $correctImageRes['width'] . '" height="' . $correctImageRes['height'] . '" alt="' . JText::_($txtE) . '" />' . '</a>' . "\n";
} else {
$o .= JHTML::_('image', 'media/com_phocagallery/images/administrator/phoca_thumb_s_no_image.gif', '');
}
}
}
$o .= ' </center>' . "\n" . ' </div>' . "\n" . ' </div>' . "\n" . ' </div>' . "\n" . ' </center>' . "\n" . '</div>' . "\n";
$o .= '</td>' . "\n";
return $o;
}
示例4: 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>';
//.........这里部分代码省略.........
示例5: 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 {
//.........这里部分代码省略.........
示例6: 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();
?>
示例7: display
//.........这里部分代码省略.........
if ($this->items[$iS]->format == 2) {
$iFormat = 'medium1';
// by portraits in everycase (medium1 = medium * x2(height))
} else {
$m2 = mt_rand(0, 1);
if ($m2 == 1) {
$iFormat = 'medium1';
}
}
}
$this->items[$iS]->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($this->items[$iS]->filename, $iFormat);
}
if (isset($parentCategory->params)) {
$this->items[$iS]->parentcategoryparams = $parentCategory->params;
}
// SWITCH IMAGE - Add the first Image as basic image
if ($this->tmpl['switch_image'] == 1) {
if ($basic_imageSelected == 0) {
if ((int) $this->tmpl['switch_width'] > 0 && (int) $this->tmpl['switch_height'] > 0 && $this->tmpl['switch_fixed_size'] == 1) {
$wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0', 'width' => $this->tmpl['switch_width'], 'height' => $this->tmpl['switch_height']);
$wHString = ' id="PhocaGalleryobjectPicture" border="0" width="' . $this->tmpl['switch_width'] . '" height="' . $this->tmpl['switch_height'] . '"';
} else {
$wHArray = array('id' => 'PhocaGalleryobjectPicture', 'border' => '0');
$wHString = ' id="PhocaGalleryobjectPicture" border="0"';
}
if (isset($this->items[$iS]->extpic) && $this->items[$iS]->extpic != '') {
$this->tmpl['basic_image'] = JHtml::_('image', $this->items[$iS]->extl, '', $wHArray);
} else {
$this->tmpl['basic_image'] = JHtml::_('image', str_replace('phoca_thumb_m_', 'phoca_thumb_l_', $this->items[$iS]->linkthumbnailpath), '', $wHString);
}
$basic_imageSelected = 1;
}
}
$thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($this->items[$iS]->filename, 'large');
$thumbLinkM = PhocaGalleryFileThumbnail::getThumbnailName($this->items[$iS]->filename, 'medium');
$imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($this->items[$iS]->filename, 1);
if ($this->tmpl['detail_window'] == 7) {
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->items[$iS]->catslug . '&id=' . $this->items[$iS]->slug . '&Itemid=' . $this->itemId);
} else {
$siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $this->items[$iS]->catslug . '&id=' . $this->items[$iS]->slug . '&tmpl=component' . '&Itemid=' . $this->itemId);
}
$imgLink = $thumbLink->rel;
if ($extImage) {
$imgLink = $this->items[$iS]->extl;
$imgLinkOrig = $this->items[$iS]->exto;
}
// Detail Window
if ($this->tmpl['detail_window'] == 2) {
$this->items[$iS]->link = $imgLink;
$this->items[$iS]->link2 = $imgLink;
$this->items[$iS]->linkother = $imgLink;
$this->items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detail_window'] == 3) {
$this->items[$iS]->link = $imgLink;
$this->items[$iS]->link2 = $imgLink;
$this->items[$iS]->linkother = $siteLink;
$this->items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detail_window'] == 5) {
$this->items[$iS]->link = $imgLink;
$this->items[$iS]->link2 = $siteLink;
$this->items[$iS]->linkother = $siteLink;
$this->items[$iS]->linkorig = $imgLinkOrig;
} else {
if ($this->tmpl['detail_window'] == 6) {
示例8: rotate
function rotate($id, $angle, &$errorMsg)
{
phocagalleryimport('phocagallery.image.imagerotate');
if ($id > 0 && $angle != '') {
$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 != '') {
$thumbNameL = PhocaGalleryFileThumbnail::getThumbnailName($file->filename, 'large');
$thumbNameM = PhocaGalleryFileThumbnail::getThumbnailName($file->filename, 'medium');
$thumbNameS = PhocaGalleryFileThumbnail::getThumbnailName($file->filename, 'small');
$errorMsg = $errorMsgS = $errorMsgM = $errorMsgL = '';
PhocaGalleryImageRotate::rotateImage($thumbNameL, 'large', $angle, $errorMsgS);
if ($errorMsgS != '') {
$errorMsg = $errorMsgS;
return false;
}
PhocaGalleryImageRotate::rotateImage($thumbNameM, 'medium', $angle, $errorMsgM);
if ($errorMsgM != '') {
$errorMsg = $errorMsgM;
return false;
}
PhocaGalleryImageRotate::rotateImage($thumbNameS, 'small', $angle, $errorMsgL);
if ($errorMsgL != '') {
$errorMsg = $errorMsgL;
return false;
}
if ($errorMsgL == '' && $errorMsgM == '' && $errorMsgS == '') {
return true;
} else {
$errorMsg = ' (' . $errorMsg . ')';
return false;
}
}
$errorMsg = JText::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS');
return false;
}
$errorMsg = JText::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED');
return false;
}
示例9: 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;
示例10: 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) {
示例11: 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)
}
示例12: displayCategoryImageOrNoImage
function displayCategoryImageOrNoImage($filename, $size)
{
phocagalleryimport('phocagallery.image.image');
phocagalleryimport('phocagallery.path.path');
phocagalleryimport('phocagallery.file.filethumbnail');
$path =& PhocaGalleryPath::getPath();
$fileThumbnail = PhocaGalleryFileThumbnail::getThumbnailName($filename, $size);
$formatIcon =& PhocaGalleryImage::getFormatIcon();
//Thumbnail_file doesn't exists
if (!JFile::exists($fileThumbnail->abs)) {
switch ($size) {
case 'large':
$fileThumbnail->rel = $path->image_rel_front . 'phoca_thumb_l_no_image.' . $formatIcon;
break;
case 'medium':
$fileThumbnail->rel = $path->image_rel_front . 'phoca_thumb_m_no_image.' . $formatIcon;
break;
default:
case 'small':
$fileThumbnail->rel = $path->image_rel_front . 'phoca_thumb_s_no_image.' . $formatIcon;
break;
}
}
return $fileThumbnail->rel;
}
示例13: 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;
示例14: onContentPrepare
//.........这里部分代码省略.........
}
}
}
}
}
if ($id > 0) {
$orderingString = PhocaGalleryOrdering::getOrderingString($tmpl['imageordering']);
$imageOrdering = $orderingString['output'];
//$c = time() * rand(1,10);
//$c = time() * mt_rand(1,1000);
$c = time() . mt_rand();
$query = ' SELECT a.filename, cc.id as catid, cc.alias as catalias, a.extid, a.exts, a.extm, a.extl, a.exto, a.description,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug' . ' FROM #__phocagallery_categories AS cc' . ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id' . ' WHERE cc.published = 1' . ' AND a.published = 1' . ' AND cc.approved = 1' . ' AND a.approved = 1' . ' AND a.catid = ' . (int) $id . $imageOrdering;
$db->setQuery($query);
$images = $db->loadObjectList();
// START OUTPUT
$jsSlideshowData['files'] = '';
$countImg = 0;
$endComma = ',';
$output = '';
if (!empty($images)) {
$countFilename = count($images);
foreach ($images as $key => $value) {
$countImg++;
if ($countImg == $countFilename) {
$endComma = '';
}
if ($desc != 'none') {
$description = PhocaGalleryText::strTrimAll(addslashes($value->description));
} else {
$description = "";
}
switch ($image) {
case 'S':
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'small');
$imageName->ext = $value->exts;
$sizeString = 's';
break;
case 'M':
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'medium');
$imageName->ext = $value->extm;
$sizeString = 'm';
break;
case 'O':
$imageName = new stdClass();
$imageName->rel = PhocaGalleryFile::getFileOriginal($value->filename, 1);
$imageName->abs = PhocaGalleryFile::getFileOriginal($value->filename, 0);
$imageName->ext = $value->exto;
$sizeString = 'l';
break;
case 'L':
default:
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'large');
$imageName->ext = $value->extl;
$sizeString = 'l';
break;
}
if (isset($value->extl) && $value->extl != '') {
$jsSlideshowData['files'] .= '["' . $imageName->ext . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$imgLink = JURI::base(true) . '/' . $imageName->rel;
if (JFile::exists($imageName->abs)) {
$jsSlideshowData['files'] .= '["' . $imgLink . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$fileThumbnail = JURI::base(true) . '/' . "components/com_phocagallery/assets/images/phoca_thumb_" . $sizeString . "_no_image.png";
$jsSlideshowData['files'] .= '["' . $fileThumbnail . '", "", "", ""]' . $endComma . "\n";
}