diff options
author | Andrew Dolgov <[email protected]> | 2021-05-07 18:48:41 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-05-07 18:48:41 +0300 |
commit | c938e08853625a0ac39e3df725d677fc7ca96c7b (patch) | |
tree | 001305b2300d91ed3ea005d1a63d47669c6742e5 | |
parent | 7273eeb09861eaa6c568a7590a5a9e61b2574e8f (diff) |
finish adding configurable webp quality
-rw-r--r-- | init.php | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -118,13 +118,14 @@ class Api_Resize_Media extends Plugin { $flag_filename = sha1($url) . ".flag"; $resized_filename = sha1($url) . "-$width"; + $quality = $this->host->profile_get($this, "quality", self::DEFAULT_QUALITY); + if (!$this->cache->exists($flag_filename) || $width <= 0) { header("Location: $url"); return; } - if ($width > self::MAX_WIDTH) - $width = self::MAX_WIDTH; + if ($width > self::MAX_WIDTH) $width = self::MAX_WIDTH; if ($this->cache->exists($local_filename)) { @@ -138,7 +139,8 @@ class Api_Resize_Media extends Plugin { $width, $width, $this->cache->get_mime_type($local_filename), - $force_stamp); + $force_stamp, + $quality); if ($this->cache->exists($resized_filename)) { header("Location: " . $this->cache->get_url($resized_filename)); @@ -165,7 +167,8 @@ class Api_Resize_Media extends Plugin { $width, $width, $this->cache->get_mime_type($local_filename), - $force_stamp); + $force_stamp, + $quality); if ($this->cache->exists($resized_filename)) { header("Location: " . $this->cache->get_url($resized_filename)); @@ -371,7 +374,7 @@ class Api_Resize_Media extends Plugin { if ($args != "prefFeeds") return; $force_width = (int) $this->host->profile_get($this, "force_width", 0); - $quality = (int) $this->host->profile_get($this, "force_width", self::DEFAULT_QUALITY); + $quality = (int) $this->host->profile_get($this, "quality", self::DEFAULT_QUALITY); ?> <div dojoType='dijit.layout.AccordionPane' |