1<?php
2
3if(!defined('DOKU_INC')) die();
4
5
6class action_plugin_resizeblacklist extends DokuWiki_Action_Plugin {
7
8    /**
9     * Register its handlers with the DokuWiki's event controller
10     */
11    public function register(Doku_Event_Handler $controller) {
12        $controller->register_hook('MEDIA_RESIZE', 'BEFORE', $this, 'can_resize');
13    }
14    /**
15     * @param Doku_Event $event  event object by reference
16     * @param mixed      $param  empty
17     * @param string     $advise the advise the hook receives
18     */
19    function can_resize(&$event, $param) {
20        $EXT = $event->data["ext"];
21        $MIME = $event->data["mime"];
22        $isImage = substr($MIME, 0, 5) == 'image';
23
24        if($isImage && (in_array("all", $this->getConf("no_resize")) || in_array($EXT, $this->getConf("no_resize"))) ) {
25            $event->preventDefault();
26        }
27    }
28}