summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-09-01 08:25:41 +0300
committerAndrew Dolgov <[email protected]>2021-09-01 08:25:41 +0300
commitb5a956422a497b560c8645d6828e638ffe4f1ae4 (patch)
treefdcc4ccb3d737a194643f7330851e2f92eef4490
parent3f8275459884a731d47dfc9279bf2d2545117d6b (diff)
rewrite_url_if_needed: properly enforce MAX_WIDTH
-rw-r--r--init.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/init.php b/init.php
index 7c22089..64a37ad 100644
--- a/init.php
+++ b/init.php
@@ -274,6 +274,9 @@ class Api_Resize_Media extends Plugin {
private function rewrite_url_if_needed($url, $width, $force_stamp = false) {
if (strpos($url, "data:") !== 0 && $width > 0) {
+ if ($width > self::MAX_WIDTH)
+ $width = self::MAX_WIDTH;
+
$local_filename = sha1($url) . "-$width";
if ($this->cache->exists($local_filename)) {