diff options
author | Andrew Dolgov <[email protected]> | 2019-08-14 15:22:26 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-08-14 15:22:26 +0300 |
commit | 78f9feaf1b1b7acaa902da6f51228efbbef8b73e (patch) | |
tree | ce8924768f71dba11ccd39b22b2358ae460225e0 | |
parent | 6ec4bf7f46c69b660efe79ae4e05b774607fa11e (diff) |
fix play icon not being applied to gif thumbnails
on success, redirect to standard cached_url from resize method
misc code cleanup
-rw-r--r-- | init.php | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -33,7 +33,7 @@ class Af_Zz_Api_Resize extends Plugin { } if ($o_im) { - $imageinfo = @getimagesizefromstring($input_filename); + $imageinfo = @getimagesize($input_filename); $o_width = imagesx($o_im) ; $o_height = imagesy($o_im) ; @@ -107,9 +107,10 @@ class Af_Zz_Api_Resize extends Plugin { if ($this->cache->exists($local_filename)) { - if ($this->cache->exists($resized_filename)) - $this->cache->send($resized_filename); - else { + if ($this->cache->exists($resized_filename)) { + header("Location: " . $this->cache->getUrl($resized_filename)); + return; + } else { $this->make_thumbnail( $this->cache->getFullPath($local_filename), $this->cache->getFullPath($resized_filename), @@ -117,10 +118,13 @@ class Af_Zz_Api_Resize extends Plugin { $width, $this->cache->getMimeType($local_filename)); - if ($this->cache->exists($resized_filename)) - $this->cache->send($resized_filename); - else - $this->cache->send($local_filename); + if ($this->cache->exists($resized_filename)) { + header("Location: " . $this->cache->getUrl($resized_filename)); + return; + } else { + header("Location: " . $this->cache->getUrl($local_filename)); + return; + } } } else { @@ -130,12 +134,11 @@ class Af_Zz_Api_Resize extends Plugin { if ($this->cache->put($local_filename, $data)) { - $mimetype = $this->cache->getMimeType($local_filename); - header("Content-type: $mimetype"); - if ($this->cache->exists($resized_filename)) - $this->cache->send($resized_filename); - else { + if ($this->cache->exists($resized_filename)) { + header("Location: " . $this->cache->getUrl($resized_filename)); + return; + } else { $this->make_thumbnail( $this->cache->getFullPath($local_filename), @@ -144,10 +147,13 @@ class Af_Zz_Api_Resize extends Plugin { $width, $this->cache->getMimeType($local_filename)); - if ($this->cache->exists($resized_filename)) - $this->cache->send($resized_filename); - else - $this->cache->send($local_filename); + if ($this->cache->exists($resized_filename)) { + header("Location: " . $this->cache->getUrl($resized_filename)); + return; + } else { + header("Location: " . $this->cache->getUrl($local_filename)); + return; + } } } else { |