summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-05-07 18:48:41 +0300
committerAndrew Dolgov <[email protected]>2021-05-07 18:48:41 +0300
commitc938e08853625a0ac39e3df725d677fc7ca96c7b (patch)
tree001305b2300d91ed3ea005d1a63d47669c6742e5
parent7273eeb09861eaa6c568a7590a5a9e61b2574e8f (diff)
finish adding configurable webp quality
-rw-r--r--init.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/init.php b/init.php
index 1c037bd..cb0a914 100644
--- a/init.php
+++ b/init.php
@@ -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'