[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresource.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/data/stringutils.class.php" ); 5 6 /** 7 * \ingroup Gallery 8 * 9 * acts as some kind of decorator adding getter methods for getting 10 * some information straight from the metadata field of the resource object, 11 * without having to overload the basic GalleryResource object with thousands 12 * of accessor methods for every single property we might need. 13 * 14 * Using this method, we can have a ImageMetadataReader which would provide 15 * methods like getHeight, getWidth, getBpp etc, and another SoundMetadataReader 16 * with methods like getFrequency, etc. 17 * 18 * The right way to use this class is: 19 * <pre> 20 * $reader = $resource->getResourceMetadataReader(); 21 * if( $resource->isImage()) { 22 * print( "image size: ".$reader->getHeight()."x".$reader->getWidth()." pixels" ); 23 * } 24 * </pre> 25 * 26 * The method GalleryResource::getResourceMetadataReader() will return the right 27 * metadata reader class so that we can check the properties of the file. We can either query 28 * the methods GalleryResource::isImage(), GalleryResource::isVideo(), etc to know which properties 29 * we can check, or use PHP's function for checking of which type a class is. 30 */ 31 class GalleryResourceBaseMetadataReader 32 { 33 var $_metadata; 34 35 function GalleryResourceBaseMetadataReader( $resource ) 36 { 37 38 39 $this->_metadata = $resource->getMetadata(); 40 } 41 42 function getMD5File() 43 { 44 return $this->_metadata["md5_file"]; 45 } 46 47 function getMD5Data() 48 { 49 return $this->_metadata["md5_data"]; 50 } 51 52 function getFileSize() 53 { 54 return $this->_metadata["filesize"]; 55 } 56 57 function getFileFormat() 58 { 59 return $this->_metadata["fileformat"]; 60 } 61 62 function getRoundedSize() 63 { 64 return StringUtils::formatSize( $this->getFileSize()); 65 } 66 } 67 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |