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


PHP PhocaGalleryFile::getFileSize方法代码示例

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


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

示例1: display


//.........这里部分代码省略.........
     }
     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);
     $item->closetext = $detailButton->getCloseText($item->catslug, $item->slug);
     $item->nextbutton = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering);
     $item->nextbuttonhref = $detailButton->getNext((int) $item->catid, (int) $item->id, (int) $item->ordering, 1);
     $item->prevbutton = $detailButton->getPrevious((int) $item->catid, (int) $item->id, (int) $item->ordering);
     $slideshowData = $detailButton->getJsSlideshow((int) $item->catid, (int) $item->id, (int) $var['slideshow'], $item->catslug, $item->slug);
     $item->slideshowbutton = $slideshowData['icons'];
     $item->slideshowfiles = $slideshowData['files'];
     $item->slideshow = $var['slideshow'];
     $item->download = $var['download'];
     // ALT VALUE
     $altValue = PhocaGalleryRenderFront::getAltValue($this->tmpl['altvalue'], $item->title, $item->description, $item->metadesc);
     $item->altvalue = $altValue;
     // Get file thumbnail or No Image
     $item->filenameno = $item->filename;
     $item->filename = PhocaGalleryFile::getTitleFromFile($item->filename, 1);
     $item->filesize = PhocaGalleryFile::getFileSize($item->filenameno);
     $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'], 'class' => 'pg-detail-image'));
         $item->realimagewidth = $correctImageRes['width'];
         $item->realimageheight = $correctImageRes['height'];
     } else {
         $item->linkthumbnailpath = PhocaGalleryImageFront::displayCategoryImageOrNoImage($item->filenameno, 'large');
         $item->linkimage = JHtml::_('image', $item->linkthumbnailpath, $item->altvalue, array('class' => 'pg-detail-image'));
         $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'];
         }
     }
     // Add Statistics
     $model->hit(JRequest::getVar('id', '', '', 'int'));
     // R A T I N G
     // Only registered (VOTES + COMMENTS)
开发者ID:optimosolution,项目名称:marhk,代码行数:67,代码来源:view.html.php

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

示例3: _addAllImagesFromFolder

 protected function _addAllImagesFromFolder(&$existingImages, $category_id, $fullPath, $rel_path, $data = array())
 {
     $count = 0;
     $fileList = JFolder::files($fullPath);
     natcasesort($fileList);
     // Iterate over the files if they exist
     //file - abc.img, file_no - folder/abc.img
     if ($fileList !== false) {
         foreach ($fileList as $filename) {
             $storedfilename = ltrim(str_replace(DS, '/', JPath::clean($rel_path . DS . $filename)), '/');
             $ext = strtolower(JFile::getExt($filename));
             // Don't create thumbnails from defined files (don't save them into a database)...
             $dontCreateThumb = PhocaGalleryFileThumbnail::dontCreateThumb($filename);
             if ($dontCreateThumb == 1) {
                 $ext = '';
                 // WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
             }
             if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') {
                 if (JFile::exists($fullPath . DS . $filename) && substr($filename, 0, 1) != '.' && strtolower($filename) !== 'index.html' && !$this->_ImageExist($existingImages, $storedfilename, $category_id)) {
                     $row = $this->getTable('phocagallery');
                     $datam = array();
                     $datam['published'] = $data['published'];
                     $datam['catid'] = $category_id;
                     $datam['filename'] = $storedfilename;
                     $datam['approved'] = $data['approved'];
                     $datam['language'] = $data['language'];
                     if ($data['title'] != '') {
                         $datam['title'] = $data['title'];
                     } else {
                         $datam['title'] = PhocaGalleryFile::getTitleFromFile($filename);
                     }
                     if ($data['alias'] != '') {
                         $datam['alias'] = $data['alias'];
                     } else {
                         $datam['alias'] = $datam['title'];
                         //PhocaGalleryText::getAliasName($datam['title']);
                     }
                     $datam['imgorigsize'] = PhocaGalleryFile::getFileSize($datam['filename'], 0);
                     $datam['format'] = PhocaGalleryFile::getFileFormat($datam['filename']);
                     // Geo
                     phocagalleryimport('phocagallery.geo.geo');
                     $coords = PhocaGalleryGeo::getGeoCoords($datam['filename']);
                     $datam['longitude'] = $coords['longitude'];
                     $datam['latitude'] = $coords['latitude'];
                     if ($datam['latitude'] != '' && $datam['longitude'] != '') {
                         $datam['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
                     }
                     // Save
                     // Bind the form fields to the Phoca gallery table
                     if (!$row->bind($datam)) {
                         $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;
                     }
                     if ($this->firstImageFolder == '') {
                         $this->setFirstImageFolder($row->filename);
                     }
                     $image = new JObject();
                     $image->filename = $storedfilename;
                     $image->catid = $category_id;
                     $existingImages[] =& $image;
                     $count++;
                 }
             }
         }
     }
     //	$this->setImageCount($count);
     return $count;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:85,代码来源:phocagallerym.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

示例5: save

 function save($data)
 {
     $params =& JComponentHelper::getParams('com_phocagallery');
     $clean_thumbnails = $params->get('clean_thumbnails', 0);
     $fileOriginalNotExist = 0;
     if ((int) $data['extid'] > 0) {
         $data['imgorigsize'] = 0;
         if ($data['title'] == '') {
             $data['title'] = 'External Image';
         }
     } else {
         //If this file doesn't exists don't save it
         if (!PhocaGalleryFile::existsFileOriginal($data['filename'])) {
             //$this->setError('Original File does not exist');
             //return false;
             $fileOriginalNotExist = 1;
             $errorMsg = JText::_('COM_PHOCAGALLERY_ORIGINAL_IMAGE_NOT_EXIST');
         }
         $data['imgorigsize'] = PhocaGalleryFile::getFileSize($data['filename'], 0);
         $data['format'] = PhocaGalleryFile::getFileFormat($data['filename']);
         //If there is no title and no alias, use filename as title and alias
         if ($data['title'] == '') {
             $data['title'] = PhocaGalleryFile::getTitleFromFile($data['filename']);
         }
     }
     if ($data['extlink1link'] != '') {
         $extlink1 = str_replace('http://', '', $data['extlink1link']);
         $data['extlink1'] = $extlink1 . '|' . $data['extlink1title'] . '|' . $data['extlink1target'] . '|' . $data['extlink1icon'];
     } else {
         $data['extlink1'] = $data['extlink1link'] . '|' . $data['extlink1title'] . '|' . $data['extlink1target'] . '|' . $data['extlink1icon'];
     }
     if ($data['extlink2link'] != '') {
         $extlink2 = str_replace('http://', '', $data['extlink2link']);
         $data['extlink2'] = $extlink2 . '|' . $data['extlink2title'] . '|' . $data['extlink2target'] . '|' . $data['extlink2icon'];
     } else {
         $data['extlink2'] = $data['extlink2link'] . '|' . $data['extlink2title'] . '|' . $data['extlink2target'] . '|' . $data['extlink2icon'];
     }
     // Geo
     if ($data['longitude'] == '' || $data['latitude'] == '') {
         phocagalleryimport('phocagallery.geo.geo');
         $coords = PhocaGalleryGeo::getGeoCoords($data['filename']);
         if ($data['longitude'] == '') {
             $data['longitude'] = $coords['longitude'];
         }
         if ($data['latitude'] == '') {
             $data['latitude'] = $coords['latitude'];
         }
         if ($data['latitude'] != '' && $data['longitude'] != '' && $data['zoom'] == '') {
             $data['zoom'] = PhocaGallerySettings::getAdvancedSettings('geozoom');
         }
     }
     if ($data['alias'] == '') {
         $data['alias'] = $data['title'];
     }
     //clean alias name (no bad characters)
     //$data['alias'] = PhocaGalleryText::getAliasName($data['alias']);
     // if new item, order last in appropriate group
     //if (!$row->id) {
     //	$where = 'catid = ' . (int) $row->catid ;
     //	$row->ordering = $row->getNextOrder( $where );
     //}
     // = = = = = = = = = =
     // Initialise variables;
     $dispatcher = JDispatcher::getInstance();
     $table = $this->getTable();
     $pk = !empty($data['id']) ? $data['id'] : (int) $this->getState($this->getName() . '.id');
     $isNew = true;
     // Include the content plugins for the on save events.
     JPluginHelper::importPlugin('content');
     // Load the row if saving an existing record.
     if ($pk > 0) {
         $table->load($pk);
         $isNew = false;
     }
     // Bind the data.
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     if (intval($table->date) == 0) {
         $table->date = JFactory::getDate()->toSql();
     }
     // Prepare the row for saving
     $this->prepareTable($table);
     // Check the data.
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     // Trigger the onContentBeforeSave event.
     /*$result = $dispatcher->trigger($this->event_before_save, array($this->option.'.'.$this->name, $table, $isNew));
     		if (in_array(false, $result, true)) {
     			$this->setError($table->getError());
     			return false;
     		}*/
     // Store the data.
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
//.........这里部分代码省略.........
开发者ID:VierlingMt,项目名称:joomla-3.x,代码行数:101,代码来源:phocagalleryimg.php


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