本文整理汇总了PHP中PhocaGalleryFileThumbnail::createFileThumbnail方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFileThumbnail::createFileThumbnail方法的具体用法?PHP PhocaGalleryFileThumbnail::createFileThumbnail怎么用?PHP PhocaGalleryFileThumbnail::createFileThumbnail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhocaGalleryFileThumbnail
的用法示例。
在下文中一共展示了PhocaGalleryFileThumbnail::createFileThumbnail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 {
//.........这里部分代码省略.........