manually set the mime type when serving .ico files

git-svn-id: file:///home/shish/svn/shimmie2/trunk@817 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish
2008-04-14 10:50:46 +00:00
parent 411b933b72
commit 7edf906065
2 changed files with 14 additions and 6 deletions

View File

@@ -37,6 +37,18 @@ class IcoFileHandler extends Extension {
if(is_a($event, 'DisplayingImageEvent') && $this->supported_ext($event->image->ext)) {
$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) {