本文整理汇总了PHP中PhocaGalleryFileThumbnail::deleteFileThumbnail方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFileThumbnail::deleteFileThumbnail方法的具体用法?PHP PhocaGalleryFileThumbnail::deleteFileThumbnail怎么用?PHP PhocaGalleryFileThumbnail::deleteFileThumbnail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhocaGalleryFileThumbnail
的用法示例。
在下文中一共展示了PhocaGalleryFileThumbnail::deleteFileThumbnail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: delete
function delete($id = 0)
{
// Get all filenames we want to delete from database, we delete all thumbnails from server of this file
$queryd = 'SELECT filename as filename FROM #__phocagallery WHERE id =' . (int) $id;
$this->_db->setQuery($queryd);
$file_object = $this->_db->loadObjectList();
$query = 'DELETE FROM #__phocagallery' . ' WHERE id =' . (int) $id;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
$this->setError('Database Error 2');
return false;
}
// Delete thumbnails - medium and large, small from server
// All id we want to delete - gel all filenames
foreach ($file_object as $key => $value) {
//The file can be stored in other category - don't delete it from server because other category use it
$querys = "SELECT id as id FROM #__phocagallery WHERE filename='" . $value->filename . "' ";
$this->_db->setQuery($queryd);
$same_file_object = $this->_db->loadObject();
//same file in other category doesn't exist - we can delete it
if (!$same_file_object) {
//Delete all thumbnail files but not original
PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1);
PhocaGalleryFile::deleteFile($value->filename);
}
}
return true;
}
示例3: 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;
}