本文整理汇总了PHP中PhocaGalleryFile类的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryFile类的具体用法?PHP PhocaGalleryFile怎么用?PHP PhocaGalleryFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhocaGalleryFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMultipleUploadSizeFormat
public static function getMultipleUploadSizeFormat($size)
{
$readableSize = PhocaGalleryFile::getFileSizeReadable($size, '%01.0f %s', 1);
$readableSize = str_replace(' ', '', $readableSize);
$readableSize = strtolower($readableSize);
return $readableSize;
}
示例2: download
function download($item, $backLink, $extLink = 0)
{
$app = JFactory::getApplication();
if (empty($item)) {
$msg = JText::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE');
$app->redirect($backLink, $msg);
return false;
} else {
if ($extLink == 0) {
phocagalleryimport('phocagallery.file.file');
$fileOriginal = PhocaGalleryFile::getFileOriginal($item->filenameno);
if (!JFile::exists($fileOriginal)) {
$msg = JText::_('COM_PHOCAGALLERY_ERROR_DOWNLOADING_FILE');
$app->redirect($backLink, $msg);
return false;
}
$fileToDownload = $item->filenameno;
$fileNameToDownload = $item->filename;
} else {
$fileToDownload = $item->exto;
$fileNameToDownload = $item->title;
$fileOriginal = $item->exto;
}
// Clears file status cache
clearstatcache();
$fileOriginal = $fileOriginal;
$fileSize = @filesize($fileOriginal);
$mimeType = PhocaGalleryFile::getMimeType($fileToDownload);
$fileName = $fileNameToDownload;
// Clean the output buffer
ob_end_clean();
header("Cache-Control: public, must-revalidate");
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header("Pragma: no-cache");
header("Expires: 0");
header("Content-Description: File Transfer");
header("Expires: Sat, 30 Dec 1990 07:07:07 GMT");
header("Content-Type: " . (string) $mimeType);
// Problem with IE
if ($extLink == 0) {
header("Content-Length: " . (string) $fileSize);
}
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header("Content-Transfer-Encoding: binary\n");
@readfile($fileOriginal);
exit;
}
return false;
}
示例3: getGeoCoords
function getGeoCoords($filename)
{
$lat = $long = '';
$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
if (!function_exists('exif_read_data')) {
return array('latitude' => 0, 'longitude' => 0);
} else {
if (JFile::getExt($fileOriginal) != 'jpg') {
return array('latitude' => 0, 'longitude' => 0);
}
// Not happy but @ must be added because of different warnings returned by exif functions - can break multiple upload
$exif = @exif_read_data($fileOriginal, 0, true);
if (empty($exif)) {
return array('latitude' => 0, 'longitude' => 0);
}
if (isset($exif['GPS']['GPSLatitude'][0])) {
$GPSLatDeg = explode('/', $exif['GPS']['GPSLatitude'][0]);
}
if (isset($exif['GPS']['GPSLatitude'][1])) {
$GPSLatMin = explode('/', $exif['GPS']['GPSLatitude'][1]);
}
if (isset($exif['GPS']['GPSLatitude'][2])) {
$GPSLatSec = explode('/', $exif['GPS']['GPSLatitude'][2]);
}
if (isset($exif['GPS']['GPSLongitude'][0])) {
$GPSLongDeg = explode('/', $exif['GPS']['GPSLongitude'][0]);
}
if (isset($exif['GPS']['GPSLongitude'][1])) {
$GPSLongMin = explode('/', $exif['GPS']['GPSLongitude'][1]);
}
if (isset($exif['GPS']['GPSLongitude'][2])) {
$GPSLongSec = explode('/', $exif['GPS']['GPSLongitude'][2]);
}
if (isset($GPSLatDeg[0]) && isset($GPSLatDeg[1]) && (int) $GPSLatDeg[1] > 0 && isset($GPSLatMin[0]) && isset($GPSLatMin[1]) && (int) $GPSLatMin[1] > 0 && isset($GPSLatSec[0]) && isset($GPSLatSec[1]) && (int) $GPSLatSec[1] > 0) {
$lat = $GPSLatDeg[0] / $GPSLatDeg[1] + $GPSLatMin[0] / $GPSLatMin[1] / 60 + $GPSLatSec[0] / $GPSLatSec[1] / 3600;
if (isset($exif['GPS']['GPSLatitudeRef']) && $exif['GPS']['GPSLatitudeRef'] == 'S') {
$lat = $lat * -1;
}
}
if (isset($GPSLongDeg[0]) && isset($GPSLongDeg[1]) && (int) $GPSLongDeg[1] > 0 && isset($GPSLongMin[0]) && isset($GPSLongMin[1]) && (int) $GPSLongMin[1] > 0 && isset($GPSLongSec[0]) && isset($GPSLongSec[1]) && (int) $GPSLongSec[1] > 0) {
$long = $GPSLongDeg[0] / $GPSLongDeg[1] + $GPSLongMin[0] / $GPSLongMin[1] / 60 + $GPSLongSec[0] / $GPSLongSec[1] / 3600;
if (isset($exif['GPS']['GPSLongitudeRef']) && $exif['GPS']['GPSLongitudeRef'] == 'W') {
$long = $long * -1;
}
}
return array('latitude' => $lat, 'longitude' => $long);
}
}
示例4: 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;
}
示例5: 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 {
//.........这里部分代码省略.........
示例6: array
echo '<h3>' . JText::_('COM_PHOCAGALLERY_EXTERNAL_LINKS2') . '</h3>' . "\n";
$formArray = array('extlink2link', 'extlink2title', 'extlink2target', 'extlink2icon');
echo $r->group($this->form, $formArray);
echo '</div>' . "\n";
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="" />';
示例7: _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;
}
示例8: deleteFile
function deleteFile($filename)
{
$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
if (JFile::exists($fileOriginal)) {
JFile::delete($fileOriginal);
return true;
}
return false;
}
示例9: onContentPrepare
//.........这里部分代码省略.........
}
}
}
}
}
if ($id > 0) {
$orderingString = PhocaGalleryOrdering::getOrderingString($tmpl['imageordering']);
$imageOrdering = $orderingString['output'];
//$c = time() * rand(1,10);
//$c = time() * mt_rand(1,1000);
$c = time() . mt_rand();
$query = ' SELECT a.filename, cc.id as catid, cc.alias as catalias, a.extid, a.exts, a.extm, a.extl, a.exto, a.description,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug' . ' FROM #__phocagallery_categories AS cc' . ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id' . ' WHERE cc.published = 1' . ' AND a.published = 1' . ' AND cc.approved = 1' . ' AND a.approved = 1' . ' AND a.catid = ' . (int) $id . $imageOrdering;
$db->setQuery($query);
$images = $db->loadObjectList();
// START OUTPUT
$jsSlideshowData['files'] = '';
$countImg = 0;
$endComma = ',';
$output = '';
if (!empty($images)) {
$countFilename = count($images);
foreach ($images as $key => $value) {
$countImg++;
if ($countImg == $countFilename) {
$endComma = '';
}
if ($desc != 'none') {
$description = PhocaGalleryText::strTrimAll(addslashes($value->description));
} else {
$description = "";
}
switch ($image) {
case 'S':
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'small');
$imageName->ext = $value->exts;
$sizeString = 's';
break;
case 'M':
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'medium');
$imageName->ext = $value->extm;
$sizeString = 'm';
break;
case 'O':
$imageName = new stdClass();
$imageName->rel = PhocaGalleryFile::getFileOriginal($value->filename, 1);
$imageName->abs = PhocaGalleryFile::getFileOriginal($value->filename, 0);
$imageName->ext = $value->exto;
$sizeString = 'l';
break;
case 'L':
default:
$imageName = PhocaGalleryFileThumbnail::getThumbnailName($value->filename, 'large');
$imageName->ext = $value->extl;
$sizeString = 'l';
break;
}
if (isset($value->extl) && $value->extl != '') {
$jsSlideshowData['files'] .= '["' . $imageName->ext . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$imgLink = JURI::base(true) . '/' . $imageName->rel;
if (JFile::exists($imageName->abs)) {
$jsSlideshowData['files'] .= '["' . $imgLink . '", "", "", "' . $description . '"]' . $endComma . "\n";
} else {
$fileThumbnail = JURI::base(true) . '/' . "components/com_phocagallery/assets/images/phoca_thumb_" . $sizeString . "_no_image.png";
$jsSlideshowData['files'] .= '["' . $fileThumbnail . '", "", "", ""]' . $endComma . "\n";
}
示例10: onContentPrepare
//.........这里部分代码省略.........
} else {
if ($plugin_type == 2) {
$image->extw = $extw[0];
//large
} else {
$image->extw = $extw[1];
//medium
}
}
$image->extwswitch = $extw[0];
//used for correcting switch
}
if ($image->exth != '') {
$exth = explode(',', $image->exth);
if ($plugin_type == 1) {
$image->exth = $exth[2];
//small
} else {
if ($plugin_type == 2) {
$image->exth = $exth[0];
//large
} else {
$image->exth = $exth[1];
//medium
}
}
$image->exthswitch = $exth[0];
//used for correcting switch
}
// - - - - - - - - -
$image->slug = $image->id . '-' . $image->alias;
// Get file thumbnail or No Image
$image->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($image->filename, $imgSize);
$file_thumbnail = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, $imgSize);
$image->linkthumbnailpathabs = $file_thumbnail->abs;
// ROUTE
//$siteLink = JRoute::_(PhocaGalleryRoute::getImageRoute($image->id, $image->catid, $image->alias, $image->catalias, 'detail', 'tmpl=component&detail='.$tmpl['detail_window'].'&buttons='.$detail_buttons );
// Different links for different actions: image, zoom icon, download icon
$thumbLink = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'large');
$thumbLinkM = PhocaGalleryFileThumbnail::getThumbnailName($image->filename, 'medium');
// ROUTE
if ($tmpl['detail_window'] == 7) {
$suffix = 'detail=' . $tmpl['detail_window'] . '&buttons=' . $detail_buttons;
} else {
$suffix = 'tmpl=component&detail=' . $tmpl['detail_window'] . '&buttons=' . $detail_buttons;
}
$siteLink = JRoute::_(PhocaGalleryRoute::getImageRoute($image->id, $image->catid, $image->alias, $image->catalias, 'detail', $suffix));
$imgLinkOrig = JURI::base(true) . '/' . PhocaGalleryFile::getFileOriginal($image->filename, 1);
$imgLink = $thumbLink->rel;
if (isset($image->extid) && $image->extid != '') {
$imgLink = $image->extl;
$imgLinkOrig = $image->exto;
}
// Different Link - to all categories
if ((int) $tmpl['pluginlink'] == 2) {
$siteLink = $imgLinkOrig = $imgLink = PhocaGalleryRoute::getCategoriesRoute();
} else {
if ((int) $tmpl['pluginlink'] == 1) {
$siteLink = $imgLinkOrig = $imgLink = PhocaGalleryRoute::getCategoryRoute($image->catid, $image->catalias);
}
}
if ($tmpl['detail_window'] == 2) {
$image->link = $imgLink;
$image->link2 = $imgLink;
$image->linkother = $siteLink;
$image->linkorig = $imgLinkOrig;
示例11: 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;
}
}
示例12: delete
public function delete(&$pks)
{
$dispatcher = JEventDispatcher::getInstance();
$pks = (array) $pks;
$table = $this->getTable();
// Include the content plugins for the on delete events.
JPluginHelper::importPlugin('content');
// Iterate the items to delete each one.
foreach ($pks as $i => $pk) {
if ($table->load($pk)) {
if ($this->canDelete($table)) {
$context = $this->option . '.' . $this->name;
// Trigger the onContentBeforeDelete event.
$result = $dispatcher->trigger($this->event_before_delete, array($context, $table));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
//PHOCAEDIT
$filePath = PhocaGalleryFile::getCSSFile($pk, true);
//END PHOCAEDIT
if (!$table->delete($pk)) {
$this->setError($table->getError());
return false;
}
//PHOCAEDIT
if (file_exists($filePath)) {
JFile::delete($filePath);
}
//END PHOCAEDIT
// Trigger the onContentAfterDelete event.
$dispatcher->trigger($this->event_after_delete, array($context, $table));
} else {
// Prune items that you can't change.
unset($pks[$i]);
$error = $this->getError();
if ($error) {
JLog::add($error, JLog::WARNING, 'jerror');
return false;
} else {
JLog::add(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
return false;
}
}
} else {
$this->setError($table->getError());
return false;
}
}
// Clear the component's cache
$this->cleanCache();
return true;
}
示例13: display
function display($tpl = null)
{
$app = JFactory::getApplication();
// PLUGIN WINDOW - we get information from plugin
$get = '';
$get['info'] = $app->input->get('info', '', 'string');
$this->itemId = $app->input->get('Itemid', 0, 'int');
$document = JFactory::getDocument();
$this->params = $app->getParams();
$this->tmpl['enablecustomcss'] = $this->params->get('enable_custom_css', 0);
$this->tmpl['customcss'] = $this->params->get('custom_css', '');
// CSS
PhocaGalleryRenderFront::renderAllCSS();
// PARAMS - Open window parameters - modal popup box or standard popup window
$this->tmpl['detailwindow'] = $this->params->get('detail_window', 0);
// Plugin information
if (isset($get['info']) && $get['info'] != '') {
$this->tmpl['detailwindow'] = $get['info'];
}
// Close and Reload links (for different window types)
$close = PhocaGalleryRenderFront::renderCloseReloadDetail($this->tmpl['detailwindow']);
$detail_window_close = $close['detailwindowclose'];
$detail_window_reload = $close['detailwindowreload'];
// PARAMS - Display Description in Detail window - set the font color
$this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff');
$description_lightbox_font_color = $this->params->get('description_lightbox_font_color', '#ffffff');
$description_lightbox_bg_color = $this->params->get('description_lightbox_bg_color', '#000000');
$description_lightbox_font_size = $this->params->get('description_lightbox_font_size', 12);
$this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', '');
$this->tmpl['gallerymetadesc'] = $this->params->get('gallery_metadesc', '');
// NO SCROLLBAR IN DETAIL WINDOW
/* $document->addCustomTag( "<style type=\"text/css\"> \n"
." html,body, .contentpane{overflow:hidden;background:".$this->tmpl['detailwindowbackgroundcolor'].";} \n"
." center, table {background:".$this->tmpl['detailwindowbackgroundcolor'].";} \n"
." #sbox-window {background-color:#fff;padding:5px} \n"
." </style> \n");
*/
// PARAMS - Get image height and width
$this->tmpl['boxlargewidth'] = $this->params->get('front_modal_box_width', 680);
$this->tmpl['boxlargeheight'] = $this->params->get('front_modal_box_height', 560);
$front_popup_window_width = $this->tmpl['boxlargewidth'];
//since version 2.2
$front_popup_window_height = $this->tmpl['boxlargeheight'];
//since version 2.2
if ($this->tmpl['detailwindow'] == 1) {
$this->tmpl['windowwidth'] = $front_popup_window_width;
$this->tmpl['windowheight'] = $front_popup_window_height;
} else {
//modal popup window
$this->tmpl['windowwidth'] = $this->tmpl['boxlargewidth'];
$this->tmpl['windowheight'] = $this->tmpl['boxlargeheight'];
}
$this->tmpl['largemapwidth'] = (int) $this->tmpl['windowwidth'] - 20;
$this->tmpl['largemapheight'] = (int) $this->tmpl['windowheight'] - 20;
$this->tmpl['googlemapsapikey'] = $this->params->get('google_maps_api_key', '');
$this->tmpl['exifinformation'] = $this->params->get('exif_information', 'FILE.FileName,FILE.FileDateTime,FILE.FileSize,FILE.MimeType,COMPUTED.Height,COMPUTED.Width,COMPUTED.IsColor,COMPUTED.ApertureFNumber,IFD0.Make,IFD0.Model,IFD0.Orientation,IFD0.XResolution,IFD0.YResolution,IFD0.ResolutionUnit,IFD0.Software,IFD0.DateTime,IFD0.Exif_IFD_Pointer,IFD0.GPS_IFD_Pointer,EXIF.ExposureTime,EXIF.FNumber,EXIF.ExposureProgram,EXIF.ISOSpeedRatings,EXIF.ExifVersion,EXIF.DateTimeOriginal,EXIF.DateTimeDigitized,EXIF.ShutterSpeedValue,EXIF.ApertureValue,EXIF.ExposureBiasValue,EXIF.MaxApertureValue,EXIF.MeteringMode,EXIF.LightSource,EXIF.Flash,EXIF.FocalLength,EXIF.SubSecTimeOriginal,EXIF.SubSecTimeDigitized,EXIF.ColorSpace,EXIF.ExifImageWidth,EXIF.ExifImageLength,EXIF.SensingMethod,EXIF.CustomRendered,EXIF.ExposureMode,EXIF.WhiteBalance,EXIF.DigitalZoomRatio,EXIF.FocalLengthIn35mmFilm,EXIF.SceneCaptureType,EXIF.GainControl,EXIF.Contrast,EXIF.Saturation,EXIF.Sharpness,EXIF.SubjectDistanceRange,GPS.GPSLatitudeRef,GPS.GPSLatitude,GPS.GPSLongitudeRef,GPS.GPSLongitude,GPS.GPSAltitudeRef,GPS.GPSAltitude,GPS.GPSTimeStamp,GPS.GPSStatus,GPS.GPSMapDatum,GPS.GPSDateStamp');
// MODEL
$model = $this->getModel();
$info = $model->getData();
// Back button
$this->tmpl['backbutton'] = '';
if ($this->tmpl['detailwindow'] == 7) {
phocagalleryimport('phocagallery.image.image');
$this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $info->catslug . '&Itemid=' . $app->input->get('Itemid', 0, 'int')) . '"' . ' title="' . JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY') . '">' . JHtml::_('image', 'media/com_phocagallery/images/icon-up-images.png', JText::_('COM_PHOCAGALLERY_BACK_TO_CATEGORY')) . '</a></div>';
}
// EXIF DATA
$outputExif = '';
$originalFile = '';
$extImage = PhocaGalleryImage::isExtImage($info->extid);
if ($extImage && isset($info->exto) && $info->exto != '') {
$originalFile = $info->exto;
} else {
if (isset($info->filename)) {
$originalFile = PhocaGalleryFile::getFileOriginal($info->filename);
}
}
if ($originalFile != '' && function_exists('exif_read_data')) {
$exif = @exif_read_data($originalFile, 'IFD0');
if ($exif === false) {
$outputExif .= JText::_('COM_PHOCAGALLERY_NO_HEADER_DATA_FOUND');
}
$setExif = $this->tmpl['exifinformation'];
$setExifArray = explode(",", $setExif, 200);
$exif = @exif_read_data($originalFile, 0, true);
/* $infoOutput = '';
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
$infoOutput .= strtoupper($key.'.'.$name).'='.$name.'<br />';
$infoOutput .= $key.'.'.$name.';';
}
}*/
$infoOutput = '';
$i = 0;
foreach ($setExifArray as $ks => $vs) {
if ($i % 2 == 0) {
$class = 'class="first"';
} else {
$class = 'class="second"';
}
if ($vs != '') {
//.........这里部分代码省略.........
示例14: display
//.........这里部分代码省略.........
$display_cat_name_breadcrumbs = $this->params->get('display_cat_name_breadcrumbs', 1);
$popup_width = $this->params->get('front_modal_box_width', 680);
$popup_height = $this->params->get('front_modal_box_height', 560);
$this->tmpl['maxuploadchar'] = $this->params->get('max_upload_char', 1000);
$this->tmpl['maxcommentchar'] = $this->params->get('max_comment_char', 1000);
$this->tmpl['maxcreatecatchar'] = $this->params->get('max_create_cat_char', 1000);
$this->tmpl['commentwidth'] = $this->params->get('comment_width', 500);
$this->tmpl['displaycategorygeotagging'] = $this->params->get('display_category_geotagging', 0);
$this->tmpl['displaycategorystatistics'] = $this->params->get('display_category_statistics', 0);
// Used for Highslide JS (only image)
$this->tmpl['displaydescriptiondetail'] = $this->params->get('display_description_detail', 0);
$this->tmpl['display_title_description'] = $this->params->get('display_title_description', 0);
$this->tmpl['charlengthname'] = $this->params->get('char_length_name', 15);
$this->tmpl['char_cat_length_name'] = $this->params->get('char_cat_length_name', 9);
$this->tmpl['display_icon_geo'] = $this->params->get('display_icon_geotagging', 0);
// Check the category
$this->tmpl['display_icon_geoimage'] = $this->params->get('display_icon_geotagging', 0);
// Check the image
$this->tmpl['display_camera_info'] = $this->params->get('display_camera_info', 0);
// PARAMS - Upload
$this->tmpl['multipleuploadchunk'] = $this->params->get('multiple_upload_chunk', 0);
$this->tmpl['displaytitleupload'] = $this->params->get('display_title_upload', 0);
$this->tmpl['displaydescupload'] = $this->params->get('display_description_upload', 0);
$this->tmpl['enablejava'] = $this->params->get('enable_java', -1);
$this->tmpl['enablemultiple'] = $this->params->get('enable_multiple', 0);
$this->tmpl['multipleuploadmethod'] = $this->params->get('multiple_upload_method', 1);
$this->tmpl['multipleresizewidth'] = $this->params->get('multiple_resize_width', -1);
$this->tmpl['multipleresizeheight'] = $this->params->get('multiple_resize_height', -1);
$this->tmpl['javaboxwidth'] = $this->params->get('java_box_width', 480);
$this->tmpl['javaboxheight'] = $this->params->get('java_box_height', 480);
$this->tmpl['large_image_width'] = $this->params->get('large_image_width', 640);
$this->tmpl['large_image_height'] = $this->params->get('large_image_height', 640);
$this->tmpl['uploadmaxsize'] = $this->params->get('upload_maxsize', 3145728);
$this->tmpl['uploadmaxsizeread'] = PhocaGalleryFile::getFileSizeReadable($this->tmpl['uploadmaxsize']);
$this->tmpl['uploadmaxreswidth'] = $this->params->get('upload_maxres_width', 3072);
$this->tmpl['uploadmaxresheight'] = $this->params->get('upload_maxres_height', 2304);
$display_description_detail = $this->params->get('display_description_detail', 0);
$description_detail_height = $this->params->get('description_detail_height', 16);
$detail_buttons = $this->params->get('detail_buttons', 1);
//$modal_box_overlay_color = $this->params->get( 'modal_box_overlay_color', '#000000' );
$modal_box_overlay_opacity = $this->params->get('modal_box_overlay_opacity', 0.3);
//$modal_box_border_color = $this->params->get( 'modal_box_border_color', '#6b6b6b' );
//$modal_box_border_width = $this->params->get( 'modal_box_border_width', '2' );
$this->tmpl['enablecooliris'] = $this->params->get('enable_cooliris', 0);
$highslide_class = $this->params->get('highslide_class', 'rounded-white');
$highslide_opacity = $this->params->get('highslide_opacity', 0);
$highslide_outline_type = $this->params->get('highslide_outline_type', 'rounded-white');
$highslide_fullimg = $this->params->get('highslide_fullimg', 0);
$highslide_slideshow = $this->params->get('highslide_slideshow', 1);
$highslide_close_button = $this->params->get('highslide_close_button', 0);
$this->tmpl['jakslideshowdelay'] = $this->params->get('jak_slideshow_delay', 5);
$this->tmpl['jakorientation'] = $this->params->get('jak_orientation', 'none');
$this->tmpl['jakdescription'] = $this->params->get('jak_description', 1);
$this->tmpl['jakdescriptionheight'] = $this->params->get('jak_description_height', 0);
$this->tmpl['categoryimageordering'] = $this->params->get('category_image_ordering', 10);
$this->tmpl['externalcommentsystem'] = $this->params->get('external_comment_system', 0);
$display_subcat_page_cv = $this->params->get('display_subcat_page_cv', 0);
$this->tmpl['display_back_button_cv'] = $this->params->get('display_back_button_cv', 1);
$this->tmpl['display_categories_back_button_cv'] = $this->params->get('display_categories_back_button_cv', 1);
$medium_image_width_cv = (int) $this->params->get('medium_image_width', 100) + 18;
$medium_image_height_cv = (int) $this->params->get('medium_image_height', 100) + 18;
$small_image_width_cv = (int) $this->params->get('small_image_width', 50) + 18;
$small_image_height_cv = (int) $this->params->get('small_image_height', 50) + 18;
$this->tmpl['imagetypecv'] = $this->tmpl['image_categories_size_cv'];
$this->tmpl['overlibimagerate'] = (int) $this->params->get('overlib_image_rate', '');
$this->tmpl['gallerymetakey'] = $this->params->get('gallery_metakey', '');
示例15: renderAllCSS
public static function renderAllCSS($noBootStrap = 0)
{
$app = JFactory::getApplication();
$itemid = $app->input->get('Itemid', 0, 'int');
$db = JFactory::getDBO();
$query = 'SELECT a.filename as filename, a.type as type, a.menulink as menulink' . ' FROM #__phocagallery_styles AS a' . ' WHERE a.published = 1' . ' ORDER BY a.type, a.ordering ASC';
$db->setQuery($query);
$filenames = $db->loadObjectList();
if (!empty($filenames)) {
foreach ($filenames as $fk => $fv) {
if ($noBootStrap == 1) {
$pos = strpos($fv->filename, 'bootstrap');
if ($pos === false) {
} else {
continue;
}
}
$path = PhocaGalleryFile::getCSSPath($fv->type, 1);
if ($fv->menulink != '') {
$menuLinks = explode(',', $fv->menulink);
$isIncluded = in_array((int) $itemid, $menuLinks);
if ($isIncluded) {
JHtml::stylesheet($path . $fv->filename);
}
} else {
JHtml::stylesheet($path . $fv->filename);
}
}
}
}