masterexploder / PHPThumb

PHP Thumbnail & Image Manipulation Library
http://phpthumb.gxdlabs.com
980 stars 264 forks source link

Save image with plugin #95

Open newerton opened 11 years ago

newerton commented 11 years ago

Suggestion:

class GD extends PHPThumb {
    [...]
    protected $pluginUsed;
    [...]
    public function show($rawData = false) {
        //Execute any plugins
        if ($this->plugins && !$this->pluginUsed) {
            foreach ($this->plugins as $plugin) {
                /* @var $plugin ThumbPluginInterface */
                $plugin->execute($this);
            }
        }

        [...]

        return $this;
    }

    [...]

    public function save($fileName, $format = null, $exec_plugin = false) {
        [...]
        //Execute any plugins
        if ($this->plugins && $exec_plugin) {
            $this->pluginUsed = true;
            foreach ($this->plugins as $plugin) {
                /* @var $plugin ThumbPluginInterface */
                $plugin->execute($this);
            }
        }
        [...]
    }

    [...]
}

It is an option for those using ta cache.