back to 2.2
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@818 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
		
							parent
							
								
									ffde804f24
								
							
						
					
					
						commit
						367546fe06
					
				@ -37,6 +37,18 @@ class IcoFileHandler extends Extension {
 | 
				
			|||||||
		if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
 | 
							if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
 | 
				
			||||||
			$this->theme->display_image($event->page, $event->image);
 | 
								$this->theme->display_image($event->page, $event->image);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if(is_a($event, 'PageRequestEvent') && ($event->page_name == "get_ico")) {
 | 
				
			||||||
 | 
								global $database;
 | 
				
			||||||
 | 
								$id = int_escape($event->get_arg(0));
 | 
				
			||||||
 | 
								$image = $database->get_image($id);
 | 
				
			||||||
 | 
								$hash = $image->hash;
 | 
				
			||||||
 | 
								$ha = substr($hash, 0, 2);
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								$event->page->set_type("image/x-icon");
 | 
				
			||||||
 | 
								$event->page->set_mode("data");
 | 
				
			||||||
 | 
								$event->page->set_data(file_get_contents("images/$ha/$hash"));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private function supported_ext($ext) {
 | 
						private function supported_ext($ext) {
 | 
				
			||||||
 | 
				
			|||||||
@ -2,13 +2,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class IcoFileHandlerTheme extends Themelet {
 | 
					class IcoFileHandlerTheme extends Themelet {
 | 
				
			||||||
	public function display_image($page, $image) {
 | 
						public function display_image($page, $image) {
 | 
				
			||||||
		$ilink = $image->get_image_link();
 | 
							$ilink = make_link("get_ico/{$image->id}/{$image->id}.ico");
 | 
				
			||||||
		$width = $image->width;
 | 
					 | 
				
			||||||
		$height = $image->height;
 | 
					 | 
				
			||||||
		$html = "
 | 
							$html = "
 | 
				
			||||||
			<object data='$ilink' type='image/x-icon' width='$width' height='$height'>
 | 
								<img id='main_image' src='$ilink'>
 | 
				
			||||||
			    <embed src='$ilink' type='image/x-icon' width='$width' height='$height' />
 | 
					 | 
				
			||||||
			</object>
 | 
					 | 
				
			||||||
		";
 | 
							";
 | 
				
			||||||
		$page->add_block(new Block("Image", $html, "main", 0));
 | 
							$page->add_block(new Block("Image", $html, "main", 0));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user