2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2008-04-11 06:12:07 +00:00
|
|
|
/**
|
|
|
|
* Name: Image Zoom
|
|
|
|
* Author: Shish <webmaster@shishnet.org>
|
|
|
|
* License: GPLv2
|
|
|
|
* Description: Scales down too-large images using browser based scaling
|
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2008-08-23 12:08:19 +00:00
|
|
|
class Zoom implements Extension {
|
2007-06-30 01:19:11 +00:00
|
|
|
var $theme;
|
|
|
|
|
2008-08-23 12:08:19 +00:00
|
|
|
public function receive_event(Event $event) {
|
2008-09-06 16:59:02 +00:00
|
|
|
if($this->theme == null) $this->theme = get_theme_object($this);
|
2007-06-30 01:19:11 +00:00
|
|
|
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof DisplayingImageEvent) {
|
2007-06-30 01:19:11 +00:00
|
|
|
global $config;
|
2007-07-16 15:25:13 +00:00
|
|
|
$this->theme->display_zoomer($event->page, $event->image, $config->get_bool("image_zoom", false));
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
|
2008-08-22 09:41:30 +00:00
|
|
|
if($event instanceof SetupBuildingEvent) {
|
2007-04-16 11:58:25 +00:00
|
|
|
$sb = new SetupBlock("Image Zoom");
|
2007-05-08 20:36:02 +00:00
|
|
|
$sb->add_bool_option("image_zoom", "Zoom by default: ");
|
2007-06-30 01:19:11 +00:00
|
|
|
$event->panel->add_block($sb);
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
add_event_listener(new Zoom());
|
|
|
|
?>
|