当前位置: 首页>>代码示例>>PHP>>正文


PHP PhocaGalleryFileThumbnail::getOrCreateThumbnail方法代码示例

本文整理汇总了PHP中PhocaGalleryFileThumbnail::getOrCreateThumbnail方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFileThumbnail::getOrCreateThumbnail方法的具体用法?PHP PhocaGalleryFileThumbnail::getOrCreateThumbnail怎么用?PHP PhocaGalleryFileThumbnail::getOrCreateThumbnail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhocaGalleryFileThumbnail的用法示例。


在下文中一共展示了PhocaGalleryFileThumbnail::getOrCreateThumbnail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:26,代码来源:phocagalleryd.php

示例2: 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;
 }
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:24,代码来源:phocagallerylinkimg.php

示例3: 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;
     }
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:61,代码来源:category.php

示例4: explode

echo '<div class="tab-pane" id="metadata">' . "\n";
echo $this->loadTemplate('metadata');
echo '</div>' . "\n";
echo '</div>';
//end tab content
echo '</div>';
//end span10
// Second Column
echo '<div class="span2">';
// - - - - - - - - - -
// Image
$fileOriginal = PhocaGalleryFile::getFileOriginal($this->item->filename);
if (!JFile::exists($fileOriginal)) {
    $this->item->fileoriginalexist = 0;
} 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);
开发者ID:naka211,项目名称:malerfirmaet,代码行数:31,代码来源:edit.php

示例5: _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;
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:63,代码来源:user.php

示例6: 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;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:79,代码来源:filefolderlist.php

示例7: 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();
         }
     }
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:61,代码来源:view.html.php

示例8: save


//.........这里部分代码省略.........
         }
     }
     // Only Imagees will be saved
     if (isset($data['cid'])) {
         foreach ($data['cid'] as $filename) {
             if ($filename) {
                 $ext = strtolower(JFile::getExt($filename));
                 // Don't create thumbnails from defined files (don't save them into a database)...
                 $dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($filename);
                 if ($dontCreateThumb == 1) {
                     $ext = '';
                     // WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
                 }
                 if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') {
                     $row = $this->getTable('phocagallery');
                     $datam = array();
                     $datam['published'] = $data['published'];
                     $datam['catid'] = $data['catid'];
                     $datam['approved'] = $data['approved'];
                     $datam['language'] = $data['language'];
                     $datam['filename'] = $filename;
                     if ($data['title'] != '') {
                         $datam['title'] = $data['title'];
                     } else {
                         $datam['title'] = PhocaGalleryFile::getTitleFromFile($filename);
                     }
                     if ($data['alias'] != '') {
                         $datam['alias'] = $data['alias'];
                     } else {
                         $datam['alias'] = $datam['title'];
                         //PhocaGalleryText::getAliasName($datam['title']);
                     }
                     $datam['imgorigsize'] = PhocaGalleryFile::getFileSize($datam['filename'], 0);
                     $datam['format'] = PhocaGalleryFile::getFileFormat($datam['filename']);
                     // Geo
                     phocagalleryimport('phocagallery.geo.geo');
                     $coords = PhocaGalleryGeo::getGeoCoords($datam['filename']);
                     $datam['longitude'] = $coords['longitude'];
                     $datam['latitude'] = $coords['latitude'];
                     if ($datam['latitude'] != '' && $datam['longitude'] != '') {
                         $datam['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
                     }
                     // Save
                     // Bind the form fields to the Phoca gallery table
                     if (!$row->bind($datam)) {
                         $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;
                     }
                     $result->image_count++;
                 }
             }
         }
         $this->setImageCount($result->image_count);
     }
     // - - - - - - - - - - - - - - - - -
     //Create thumbnail small, medium, large
     //file - abc.img, file_no - folder/abc.img
     //Get folder variables from Helper
     //	$refresh_url 	= 'index.php?option=com_phocagallery&task=phocagalleryimg.thumbs';
     $msg = $this->categoryCount . ' ' . JText::_('COM_PHOCAGALLERY_CATEGORIES_ADDED') . ', ' . $this->imageCount . ' ' . JText::_('COM_PHOCAGALLERY_IMAGES_ADDED');
     $app->enqueueMessage($msg);
     $app->redirect(JRoute::_('index.php?option=com_phocagallery&view=phocagalleryimgs&countimg=' . $this->imageCount . '&imagesid=' . md5(time()), false));
     // Only image without folder was added to the system
     if (isset($row->filename) && $row->filename != '') {
         $fileNameThumb = $row->filename;
     } else {
         if ($this->firstImageFolder != '') {
             $fileNameThumb = $this->firstImageFolder;
         } else {
             $fileNameThumb == '';
         }
     }
     if ($fileNameThumb != '') {
         $refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryimgs&countimg=' . $this->imageCount;
         $fileThumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($fileNameThumb, $refresh_url, 1, 1, 1);
     }
     //Clean Thumbs Folder if there are thumbnail files but not original file
     if ($clean_thumbnails == 1) {
         PhocaGalleryFolder::cleanThumbsFolder();
     }
     // - - - - - - - - - - - - - - - - -
     return true;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:101,代码来源:phocagallerym.php

示例9: save


//.........这里部分代码省略.........
         }
     }
     if ($data['alias'] == '') {
         $data['alias'] = $data['title'];
     }
     //clean alias name (no bad characters)
     //$data['alias'] = PhocaGalleryText::getAliasName($data['alias']);
     // if new item, order last in appropriate group
     //if (!$row->id) {
     //	$where = 'catid = ' . (int) $row->catid ;
     //	$row->ordering = $row->getNextOrder( $where );
     //}
     // = = = = = = = = = =
     // Initialise variables;
     $dispatcher = JDispatcher::getInstance();
     $table = $this->getTable();
     $pk = !empty($data['id']) ? $data['id'] : (int) $this->getState($this->getName() . '.id');
     $isNew = true;
     // Include the content plugins for the on save events.
     JPluginHelper::importPlugin('content');
     // Load the row if saving an existing record.
     if ($pk > 0) {
         $table->load($pk);
         $isNew = false;
     }
     // Bind the data.
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     if (intval($table->date) == 0) {
         $table->date = JFactory::getDate()->toSql();
     }
     // Prepare the row for saving
     $this->prepareTable($table);
     // Check the data.
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     // Trigger the onContentBeforeSave event.
     /*$result = $dispatcher->trigger($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew));
     		if (in_array(false, $result, true)) {
     			$this->setError($table->getError());
     			return false;
     		}*/
     // Store the data.
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
     // Store to ref table
     if (!isset($data['tags'])) {
         $data['tags'] = array();
     }
     if ((int) $table->id > 0) {
         PhocaGalleryTag::storeTags($data['tags'], (int) $table->id);
     }
     // Clean the cache.
     $cache = JFactory::getCache($this->option);
     $cache->clean();
     // Trigger the onContentAfterSave event.
     //$dispatcher->trigger($this->event_after_save, array($this->option.'.'.$this->name, $table, $isNew));
     $pkName = $table->getKeyName();
     if (isset($table->{$pkName})) {
         $this->setState($this->getName() . '.id', $table->{$pkName});
     }
     $this->setState($this->getName() . '.new', $isNew);
     // = = = = = =
     $task = JRequest::getVar('task');
     if (isset($table->{$pkName})) {
         $id = $table->{$pkName};
     }
     if ((int) $data['extid'] > 0 || $fileOriginalNotExist == 1) {
     } else {
         // - - - - - - - - - - - - - - - - - -
         //Create thumbnail small, medium, large
         //file - abc.img, file_no - folder/abc.img
         //Get folder variables from Helper
         //Create thumbnails small, medium, large
         $refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.thumbs';
         $task = JRequest::getVar('task');
         if (isset($table->{$pkName}) && $task == 'apply') {
             $id = $table->{$pkName};
             $refresh_url = 'index.php?option=com_phocagallery&task=phocagalleryimg.edit&id=' . (int) $id;
         }
         if ($task == 'save2new') {
             // Don't create automatically thumbnails in case, we are going to add new image
         } else {
             $file_thumb = PhocaGalleryFileThumbnail::getOrCreateThumbnail($data['filename'], $refresh_url, 1, 1, 1);
         }
         //Clean Thumbs Folder if there are thumbnail files but not original file
         if ($clean_thumbnails == 1) {
             phocagalleryimport('phocagallery.file.filefolder');
             PhocaGalleryFileFolder::cleanThumbsFolder();
         }
         // - - - - - - - - - - - - - - - - - - - - -
     }
     return true;
 }
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:101,代码来源:phocagalleryimg.php

示例10: 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;
     }
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:74,代码来源:phocagalleryc.php


注:本文中的PhocaGalleryFileThumbnail::getOrCreateThumbnail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。