本文整理汇总了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;
}
}
示例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;
}