summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-08-14 15:22:26 +0300
committerAndrew Dolgov <[email protected]>2019-08-14 15:22:26 +0300
commit78f9feaf1b1b7acaa902da6f51228efbbef8b73e (patch)
treece8924768f71dba11ccd39b22b2358ae460225e0
parent6ec4bf7f46c69b660efe79ae4e05b774607fa11e (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.php40
1 files changed, 23 insertions, 17 deletions
diff --git a/init.php b/init.php
index c6edf05..43fa2c5 100644
--- a/init.php
+++ b/init.php
@@ -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 {