當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhocaGalleryFile::existsFileOriginal方法代碼示例

本文整理匯總了PHP中PhocaGalleryFile::existsFileOriginal方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhocaGalleryFile::existsFileOriginal方法的具體用法?PHP PhocaGalleryFile::existsFileOriginal怎麽用?PHP PhocaGalleryFile::existsFileOriginal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhocaGalleryFile的用法示例。


在下文中一共展示了PhocaGalleryFile::existsFileOriginal方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: recreate

 function recreate($cid = array(), &$message)
 {
     if (count($cid)) {
         JArrayHelper::toInteger($cid);
         $cids = implode(',', $cid);
         $query = 'SELECT a.filename, a.extid' . ' FROM #__phocagallery AS a' . ' WHERE a.id IN ( ' . $cids . ' )';
         $this->_db->setQuery($query);
         $files = $this->_db->loadObjectList();
         if (isset($files) && count($files)) {
             foreach ($files as $key => $value) {
                 if (isset($value->extid) && (int) $value->extid > 0) {
                     // Picasa cannot be recreated
                     $message = JText::_('COM_PHOCAGALLERY_ERROR_EXT_IMG_NOT_RECREATE');
                     return false;
                 } else {
                     if (isset($value->filename) && $value->filename != '') {
                         $original = PhocaGalleryFile::existsFileOriginal($value->filename);
                         if (!$original) {
                             // Original does not exist - cannot generate new thumbnail
                             $message = JText::_('COM_PHOCAGALLERY_FILEORIGINAL_NOT_EXISTS');
                             return false;
                         }
                         // Delete old thumbnails
                         $deleteThubms = PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1);
                     } else {
                         $message = JText::_('COM_PHOCAGALLERY_FILENAME_NOT_EXISTS');
                         return false;
                     }
                 }
                 if (!$deleteThubms) {
                     $message = JText::_('COM_PHOCAGALLERY_ERROR_DELETE_THUMBNAIL');
                     return false;
                 }
             }
         } else {
             $message = JText::_('COM_PHOCAGALLERY_ERROR_LOADING_DATA_DB');
             return false;
         }
     } else {
         $message = JText::_('COM_PHOCAGALLERY_ERROR_ITEM_NOT_SELECTED');
         return false;
     }
     return true;
 }
開發者ID:VierlingMt,項目名稱:joomla-3.x,代碼行數:44,代碼來源:phocagalleryimg.php


注:本文中的PhocaGalleryFile::existsFileOriginal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。