| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-27 12:49:32 +04:00
										 |  |  | class Image extends File | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  | { | 
					
						
							|  |  |  |     public $width; | 
					
						
							|  |  |  |     public $height; | 
					
						
							|  |  |  |     public $type; | 
					
						
							|  |  |  |     public $size; | 
					
						
							| 
									
										
										
										
											2013-05-27 12:49:32 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  |     public $original_filename; | 
					
						
							|  |  |  |     public $variants = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-10 16:46:29 +04:00
										 |  |  |     protected static $sizes; | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							| 
									
										
										
										
											2013-05-29 15:01:54 +04:00
										 |  |  |      * @param $class string | 
					
						
							|  |  |  |      * @throws ErrorException | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2013-05-29 15:01:54 +04:00
										 |  |  |     public static function checkSubClass($class) | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2013-05-29 15:01:54 +04:00
										 |  |  |         if (is_null($class) || $class == '') { | 
					
						
							|  |  |  |             throw new ErrorException('Class not defined.'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (!class_exists($class)) { | 
					
						
							|  |  |  |             throw new ErrorException('Class "' . $class . '" not exists.'); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (get_parent_class($class) != 'Image') { | 
					
						
							|  |  |  |             throw new ErrorException('Class "' . $class . '" mast be extend of "Image".'); | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-05-29 15:01:54 +04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function getSizes() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2013-06-10 16:46:29 +04:00
										 |  |  |         return self::$sizes; | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-06-07 12:18:25 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function getVariant($size) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return parent::getImageVariant($size); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-05-24 13:27:47 +04:00
										 |  |  | } |