📄 galleryresource.class.php
字号:
$albums = new GalleryAlbums(); $this->_album = $albums->getAlbum( $this->getAlbumId()); } return $this->_album; } /** * Sets the descriptoion of the object * * @param description the new description */ function setDescription( $description ) { $this->_description = $description; } /** * @return returns the format of the thumbnail that was generated for this file, if any. Of * course this method has no relevance if the object is not representing an image */ function getThumbnailFormat() { return $this->_thumbnailFormat; } /** * Sets the thumbnail format * * @return nothing */ function setThumbnailFormat( $format ) { $this->_thumbnailFormat = $format; } /** * returns the size of the resource file * * @return the size of the file in bytes */ function getFileSize() { return( $this->_fileSize ); } function setFileSize( $size ) { $this->_fileSize = $size; } /** * returns an object that will allow to access the metadata of this resource * * @see GalleryResourceImageMetadataReader * @see GalleryResourceSoundMetadataReader * @see GalleryResourceVideoMoetadataReader * @see GalleryResourceZipMetadataReader * @see GalleryResourceBaseMetadataReader */ function getMetadataReader() { lt_include( PLOG_CLASS_PATH."class/gallery/data/galleryresourceimagemetadatareader.class.php" ); lt_include( PLOG_CLASS_PATH."class/gallery/data/galleryresourcesoundmetadatareader.class.php" ); lt_include( PLOG_CLASS_PATH."class/gallery/data/galleryresourcevideometadatareader.class.php" ); lt_include( PLOG_CLASS_PATH."class/gallery/data/galleryresourcezipmetadatareader.class.php" ); switch( $this->getResourceType()) { case GALLERY_RESOURCE_IMAGE: $reader = new GalleryResourceImageMetadataReader( $this ); break; case GALLERY_RESOURCE_SOUND: $reader = new GalleryResourceSoundMetadataReader( $this ); break; case GALLERY_RESOURCE_VIDEO: $reader = new GalleryResourceVideoMetadataReader( $this ); break; case GALLERY_RESOURCE_ZIP: $reader = new GalleryResourceZipMetadataReader( $this ); break; default: $reader = new GalleryResourceBaseMetadataReader( $this ); break; } return $reader; } /** * Returns true if this resource has a preview or false if not. * * @return True if preview available or false otherwise. */ function hasPreview() { return( $this->_flags & GALLERY_RESOURCE_PREVIEW_AVAILABLE ); } /** * returns the name of the file in disk where the preview is * stored * * @return the path to the small preview file */ function getPreviewFileName() { lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" ); $config =& Config::getConfig(); // encoding the filename if "encoded_file_name" enabled if( $config->getValue( "resources_naming_rule" ) == "encoded_file_name" ) $fileName = $this->getEncodedFileName(); else $fileName = $this->getFileName(); // change the file extension, if the thumbnail output format is different from the original file if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) $previewFile = $fileName; else $previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $fileName ); return $previewFile; } /** * @private */ function _getFileExtension() { $fileName = $this->getFileName(); if(( $extPos = strrpos( $fileName, "." )) !== false ) { $fileExt = substr( $fileName, $extPos+1, strlen( $fileName )); } else { $fileExt = ""; } return( $fileExt ); } /** * returns the full path to the file with the medium-sized preview * * @return full path to the medium-sized preview */ function getMediumSizePreviewFileName() { lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" ); $config =& Config::getConfig(); // encoding the filename if "encoded_file_name" enabled if( $config->getValue( "resources_naming_rule" ) == "encoded_file_name" ) $fileName = $this->getEncodedFileName(); else $fileName = $this->getFileName(); // change the file extension, if the thumbnail output format is different from the original file if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) $previewFile = $fileName; else $previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $fileName ); return $previewFile; } /** * returns the full path to the file with the original size * * @return full path to the original size */ function getOriginalSizeFileName() { lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" ); $config =& Config::getConfig(); // encoding the filename if "encoded_file_name" enabled if( $config->getValue( "resources_naming_rule" ) == "encoded_file_name" ) $fileName = $this->getEncodedFileName(); else $fileName = $this->getFileName(); return $fileName; } function getNormalizedDescription() { lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" ); $tf = new Textfilter(); return( $tf->normalizeText( $this->getDescription())); } /** * @return true if the resource is an image */ function isImage() { return( $this->_resourceType == GALLERY_RESOURCE_IMAGE ); } /** * @return true if the resource is a sound file */ function isSound() { return( $this->_resourceType == GALLERY_RESOURCE_SOUND ); } /** * @return true if the resource file is a video */ function isVideo() { return( $this->_resourceType == GALLERY_RESOURCE_VIDEO ); } /** * @return true if the resource file is a ZIP file */ function isZip() { return( $this->_resourceType == GALLERY_RESOURCE_ZIP ); } /** * returns the link to the resource page */ function getResourceLink() { $blog = $this->getBlogInfo(); $url = $blog->getBlogRequestGenerator(); return( $url->resourceLink( $this )); } /** * returns the download link for this resource */ function getLink() { $blog = $this->getBlogInfo(); $url = $blog->getBlogRequestGenerator(); return( $url->resourceDownloadLink( $this )); } /** * returns the preview link (thumbnail) for this resource if it's an image, or an empty string otherwise */ function getPreviewLink() { $link = ""; if( $this->isImage()) { $blog = $this->getBlogInfo(); $url = $blog->getBlogRequestGenerator(); $link = $url->resourcePreviewLink( $this ); } return( $link ); } /** * returns the medium preview link (thumbnail) for this resource if it's an image, * or an empty string otherwise */ function getMediumPreviewLink() { $link = ""; if( $this->isImage()) { $blog = $this->getBlogInfo(); $url = $blog->getBlogRequestGenerator(); $link = $url->resourceMediumSizePreviewLink( $this ); } return( $link ); } }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -