当前位置: 首页>>代码示例>>PHP>>正文


PHP PhocaGalleryImage::getImageSize方法代码示例

本文整理汇总了PHP中PhocaGalleryImage::getImageSize方法的典型用法代码示例。如果您正苦于以下问题:PHP PhocaGalleryImage::getImageSize方法的具体用法?PHP PhocaGalleryImage::getImageSize怎么用?PHP PhocaGalleryImage::getImageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhocaGalleryImage的用法示例。


在下文中一共展示了PhocaGalleryImage::getImageSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display


//.........这里部分代码省略.........
     // No bar in Detail View
     if ($this->tmpl['detailwindow'] == 7) {
     } else {
         $document->addCustomTag("<style type=\"text/css\"> \n" . " html, body, .contentpane, #all, #main {" . $oH . "background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";padding:0px !important;margin:0px !important; width: 100% !important; max-width: 100% !important;} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . "body {min-width:100%} \n" . ".rt-container {width:100%} \n" . " </style> \n");
     }
     // Download from the detail view which is not in the popupbox
     if ($var['download'] == 2) {
         $this->tmpl['displayicondownload'] = 2;
     }
     // Plugin Information
     if (isset($get['ratingimg']) && $get['ratingimg'] != '') {
         $this->tmpl['displayratingimg'] = $get['ratingimg'];
     }
     // Model
     $model =& $this->getModel();
     $item = $model->getData();
     //Multibox Thumbnails
     $this->tmpl['mb_thumbs_data'] = '';
     if ($this->tmpl['mb_thumbs'] == 1) {
         // if we get item variable, we have rights to load the thumbnails, this is why we checking it
         if (isset($item->id) && isset($item->catid) && (int) $item->id > 0 && (int) $item->catid > 0) {
             $this->tmpl['mb_thumbs_data'] = $model->getThumbnails((int) $item->id, (int) $item->catid, (int) $item->ordering);
         }
     }
     // User Avatar
     $this->tmpl['useravatarimg'] = '';
     $this->tmpl['useravatarmiddle'] = '';
     $userAvatar = PhocaGalleryUser::getUserAvatar($item->userid);
     if ($userAvatar) {
         $pathAvatarAbs = $path->avatar_abs . 'thumbs' . DS . 'phoca_thumb_s_' . $userAvatar->avatar;
         $pathAvatarRel = $path->avatar_rel . 'thumbs/phoca_thumb_s_' . $userAvatar->avatar;
         if (JFile::exists($pathAvatarAbs)) {
             $sIH = $this->params->get('small_image_height', 50);
             $sIHR = @getImageSize($pathAvatarAbs);
             if (isset($sIHR[1])) {
                 $sIH = $sIHR[1];
             }
             if ((int) $sIH > 0) {
                 $this->tmpl['useravatarmiddle'] = (int) $sIH / 2 - 10;
             }
             $this->tmpl['useravatarimg'] = '<img src="' . JURI::base(true) . '/' . $pathAvatarRel . '?imagesid=' . md5(uniqid(time())) . '" alt="" />';
         }
     }
     // Access check - don't display the image if you have no access to this image (if user add own url)
     // USER RIGHT - ACCESS - - - - - - - - - -
     $rightDisplay = 0;
     if (!empty($item)) {
         $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $item->cataccessuserid, $item->cataccess, $user->authorisedLevels(), $user->get('id', 0), 0);
     }
     if ((int) $rightDisplay == 0) {
         echo $close['html'];
         //Some problem with cache - Joomla! return this message if there is no reason for do it.
         //$this->tmpl['pl']		= 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
         //$app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'));
         exit;
     }
     // - - - - - - - - - - - - - - - - - - - -
     phocagalleryimport('phocagallery.image.image');
     phocagalleryimport('phocagallery.render.renderdetailbutton');
     // Javascript Slideshow buttons
     $detailButton = new PhocaGalleryRenderDetailButton();
     if ($this->tmpl['enable_multibox'] == 1) {
         $detailButton->setType('multibox');
     }
     $item->reloadbutton = $detailButton->getReload($item->catslug, $item->slug);
     $item->closebutton = $detailButton->getClose($item->catslug, $item->slug);
开发者ID:optimosolution,项目名称:marhk,代码行数:67,代码来源:view.html.php

示例2: _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;
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:63,代码来源:user.php

示例3: canUpload

 /**
  * can Upload
  *
  * @param array $file
  * @param string $errorUploadMsg
  * @param int $frontEnd - if it is called from frontend or backend (1  - category view, 2 user control panel)
  * @param boolean $chunkMethod - if chunk method is used (multiple upload) then there are special rules
  * @param string $realSize - if chunk method is used we get info about real size of file (not only the part)
  * @return boolean True on success
  * @since 1.5
  */
 public static function canUpload($file, &$errUploadMsg, $frontEnd = 0, $chunkEnabled = 0, $realSize = 0)
 {
     $params = JComponentHelper::getParams('com_phocagallery');
     $paramsL = array();
     $paramsL['upload_extensions'] = 'gif,jpg,png,jpeg';
     $paramsL['image_extensions'] = 'gif,jpg,png,jpeg';
     $paramsL['upload_mime'] = 'image/jpeg,image/gif,image/png';
     $paramsL['upload_mime_illegal'] = 'application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip,text/html';
     // The file doesn't exist
     if (empty($file['name'])) {
         $errUploadMsg = 'COM_PHOCAGALLERY_ERROR_UNABLE_TO_UPLOAD_FILE';
         return false;
     }
     // Not safe file
     jimport('joomla.filesystem.file');
     if ($file['name'] !== JFile::makesafe($file['name'])) {
         $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILENAME';
         return false;
     }
     $format = strtolower(JFile::getExt($file['name']));
     // Allowable extension
     $allowable = explode(',', $paramsL['upload_extensions']);
     if ($format == '' || $format == false || !in_array($format, $allowable)) {
         //if (!in_array($format, $allowable)) {
         $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILETYPE';
         return false;
     }
     // 'COM_PHOCAGALLERY_MAX_RESOLUTION'
     $imgSize = PhocaGalleryImage::getImageSize($file['tmp_name']);
     $maxResWidth = $params->get('upload_maxres_width', 3072);
     $maxResHeight = $params->get('upload_maxres_height', 2304);
     if ((int) $maxResWidth > 0 && (int) $maxResHeight > 0 && ((int) $imgSize[0] > (int) $maxResWidth || (int) $imgSize[1] > (int) $maxResHeight)) {
         $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE_RESOLUTION';
         return false;
     }
     // User (only in ucp) - Check the size of all images by users
     if ($frontEnd == 2) {
         $user = JFactory::getUser();
         $maxUserImageSize = (int) $params->get('user_images_max_size', 20971520);
         if ($chunkEnabled == 1) {
             $fileSize = $realSize;
         } else {
             $fileSize = $file['size'];
         }
         $allFileSize = PhocaGalleryFileUploadFront::getSizeAllOriginalImages($fileSize, $user->id);
         if ((int) $maxUserImageSize > 0 && (int) $allFileSize > $maxUserImageSize) {
             $errUploadMsg = JText::_('COM_PHOCAGALLERY_WARNING_USERIMAGES_TOOLARGE');
             return false;
         }
     }
     // Max size of image
     // If chunk method is used, we need to get computed size
     $maxSize = $params->get('upload_maxsize', 3145728);
     if ($chunkEnabled == 1) {
         if ((int) $maxSize > 0 && (int) $realSize > (int) $maxSize) {
             $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE';
             return false;
         }
     } else {
         if ((int) $maxSize > 0 && (int) $file['size'] > (int) $maxSize) {
             $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_FILE_TOOLARGE';
             return false;
         }
     }
     $user = JFactory::getUser();
     $imginfo = null;
     // Image check
     $images = explode(',', $paramsL['image_extensions']);
     if (in_array($format, $images)) {
         // if its an image run it through getimagesize
         if ($chunkEnabled != 1) {
             if (($imginfo = getimagesize($file['tmp_name'])) === FALSE) {
                 $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_INVALIDIMG';
                 return false;
             }
         }
     } else {
         if (!in_array($format, $images)) {
             // if its not an image...and we're not ignoring it
             $allowed_mime = explode(',', $paramsL['upload_mime']);
             $illegal_mime = explode(',', $paramsL['upload_mime_illegal']);
             if (function_exists('finfo_open')) {
                 // We have fileinfo
                 $finfo = finfo_open(FILEINFO_MIME);
                 $type = finfo_file($finfo, $file['tmp_name']);
                 if (strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime)) {
                     $errUploadMsg = 'COM_PHOCAGALLERY_WARNING_INVALIDMIME';
                     return false;
                 }
//.........这里部分代码省略.........
开发者ID:scarsroga,项目名称:blog-soa,代码行数:101,代码来源:fileupload.php

示例4: display


//.........这里部分代码省略.........
         // Seems we are in iframe
         $this->tmpl['enable_multibox_iframe'] = 1;
     }
     // CSS
     PhocaGalleryRenderFront::renderAllCSS();
     if ($this->tmpl['gallerymetakey'] != '') {
         $document->setMetaData('keywords', $this->tmpl['gallerymetakey']);
     }
     if ($this->tmpl['gallerymetadesc'] != '') {
         $document->setMetaData('description', $this->tmpl['gallerymetadesc']);
     }
     // PARAMS - Open window parameters - modal popup box or standard popup window
     $detail_window = $this->params->get('detail_window', 0);
     // Plugin information
     if (isset($get['comment']) && $get['comment'] != '') {
         $detail_window = $get['comment'];
     }
     // Only registered (VOTES + COMMENTS)
     $this->tmpl['not_registered'] = true;
     $this->tmpl['name'] = '';
     if ($access) {
         $this->tmpl['not_registered'] = false;
         $this->tmpl['name'] = $user->name;
     }
     $document->addScript(JURI::base(true) . '/media/com_phocagallery/js/comments.js');
     $document->addCustomTag(PhocaGalleryRenderFront::renderCommentJS((int) $this->tmpl['maxcommentchar']));
     $this->tmpl['already_commented'] = PhocaGalleryCommentImage::checkUserComment((int) $this->tmpl['id'], (int) $user->id);
     $commentItem = PhocaGalleryCommentImage::displayComment((int) $this->tmpl['id']);
     // PARAMS - Display Description in Detail window - set the font color
     $this->tmpl['detailwindowbackgroundcolor'] = $this->params->get('detail_window_background_color', '#ffffff');
     $this->tmpl['detailwindow'] = $this->params->get('detail_window', 0);
     $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);
     // NO SCROLLBAR IN DETAIL WINDOW
     $document->addCustomTag("<style type=\"text/css\"> \n" . " html,body, .contentpane{background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";text-align:left;} \n" . " center, table {background:" . $this->tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff;padding:5px} \n" . " </style> \n");
     $model = $this->getModel();
     $item = $model->getData();
     $this->tmpl['imgtitle'] = $item->title;
     // Back button
     $this->tmpl['backbutton'] = '';
     if ($this->tmpl['detailwindow'] == 7 || $this->tmpl['display_comment_nopup']) {
         // Display Image
         // Access check - don't display the image if you have no access to this image (if user add own url)
         // USER RIGHT - ACCESS - - - - - - - - - -
         $rightDisplay = 0;
         if (!empty($item)) {
             $rightDisplay = PhocaGalleryAccess::getUserRight('accessuserid', $item->cataccessuserid, $item->cataccess, $user->getAuthorisedViewLevels(), $user->get('id', 0), 0);
         }
         if ($rightDisplay == 0) {
             $this->tmpl['pl'] = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString());
             $app->redirect(JRoute::_($this->tmpl['pl'], false), JText::_('COM_PHOCAGALLERY_NOT_AUTHORISED_ACTION'));
             exit;
         }
         // - - - - - - - - - - - - - - - - - - - -
         phocagalleryimport('phocagallery.image.image');
         $this->tmpl['backbutton'] = '<div><a href="' . JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $this->tmpl['catid'] . '&Itemid=' . $this->itemId) . '"' . ' 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>';
         // Get file thumbnail or No Image
         $item->filenameno = $item->filename;
         $item->filename = PhocaGalleryFile::getTitleFromFile($item->filename, 1);
         $item->filesize = PhocaGalleryFile::getFileSize($item->filenameno);
         $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $item->title, $item->description, $item->metadesc);
         $item->altvalue = $altValue;
         $realImageSize = '';
         $extImage = PhocaGalleryImage::isExtImage($item->extid);
         if ($extImage) {
             $item->extl = $item->extl;
             $item->exto = $item->exto;
             $realImageSize = PhocaGalleryImage::getRealImageSize($item->extl, '', 1);
             $item->imagesize = PhocaGalleryImage::getImageSize($item->exto, 1, 1);
             if ($item->extw != '') {
                 $extw = explode(',', $item->extw);
                 $item->extw = $extw[0];
             }
             $correctImageRes = PhocaGalleryPicasa::correctSizeWithRate($item->extw, $item->exth, $this->tmpl['picasa_correct_width_l'], $this->tmpl['picasa_correct_height_l']);
             $item->linkimage = JHtml::_('image', $item->extl, $item->altvalue, array('width' => $correctImageRes['width'], 'height' => $correctImageRes['height']));
             $item->realimagewidth = $correctImageRes['width'];
             $item->realimageheight = $correctImageRes['height'];
         } else {
             $item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large');
             $item->linkimage = JHtml::_('image', $item->linkthumbnailpath, $item->altvalue);
             $realImageSize = PhocaGalleryImage::getRealImageSize($item->filenameno);
             $item->imagesize = PhocaGalleryImage::getImageSize($item->filenameno, 1);
             if (isset($realImageSize['w']) && isset($realImageSize['h'])) {
                 $item->realimagewidth = $realImageSize['w'];
                 $item->realimageheight = $realImageSize['h'];
             } else {
                 $item->realimagewidth = $this->tmpl['largewidth'];
                 $item->realimageheight = $this->tmpl['largeheight'];
             }
         }
         $this->assignRef('item', $item);
     }
     // ACTION
     $this->assignRef('item', $item);
     $this->tmpl['action'] = $uri->toString();
     $this->assignRef('commentitem', $commentItem);
     $this->_prepareDocument($item);
     parent::display($tpl);
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:101,代码来源:view.html.php


注:本文中的PhocaGalleryImage::getImageSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。