diff options
author | Andrew Dolgov <[email protected]> | 2019-08-12 19:20:00 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-08-12 19:20:00 +0300 |
commit | bac38d9accde677203ccf08e120432521e947ecd (patch) | |
tree | 53721783a923b18c76790dad9481990f52eaf4b9 | |
parent | b9e0c4ade026c1b1a791090698c6f7abbd8ca62c (diff) |
remove resize_enabled
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | init.php | 5 |
2 files changed, 4 insertions, 6 deletions
@@ -3,10 +3,9 @@ Downsamples images if an API client requests the backend to do so. Useful for slow or unreliable network connections, i.e. mobile internet. -This plugin handles two additional parameters passed to ``getHeadlines`` or ``getArticle`` -API call: +This plugin handles an additional parameter passed to ``getHeadlines`` +or ``getArticle`` API calls: -* ``resize_enabled`` (bool) - enable or disable resizing * ``resize_width`` (int) - target width (or height, plugin resizes based on a larger dimension) Images are saved in a WEBP format. @@ -110,7 +110,7 @@ class Af_Zz_Api_Resize extends Plugin { $flag_filename = CACHE_DIR . "/images/" . sha1($url) . ".flag"; $resized_filename = CACHE_DIR . "/images/" . sha1($url) . "-$width"; - if (!file_exists($flag_filename) || !$width) { + if (!file_exists($flag_filename) || $width <= 0) { header("Location: $url"); return; } @@ -206,9 +206,8 @@ class Af_Zz_Api_Resize extends Plugin { function hook_render_article_api($params) { $need_saving = false; $width = (int) clean($_REQUEST["resize_width"]); - $enabled = sql_bool_to_bool(clean($_REQUEST["resize_enabled"])); - if (!$enabled || !$width) + if ($width <= 0) return $params["headline"]; $doc = new DOMDocument(); |