dever 6 years ago
parent
commit
38739b967d
2 changed files with 14 additions and 9 deletions
  1. 1 2
      src/Store/Local.php
  2. 13 7
      src/View.php

+ 1 - 2
src/Store/Local.php

@@ -152,6 +152,7 @@ class Local extends Core implements Config
 			$source = $this->output['file'];
 		}
 
+
 		if (!$dest) {
 			if (strpos($this->name, '_wp') !== false) {
 				$temp = explode('_wp', $this->name);
@@ -160,8 +161,6 @@ class Local extends Core implements Config
 			$this->ext = '.webp';
 			$this->name .= '_wp' . $num;
 			$dest = $this->file();
-		} else {
-			$dest .= '.webp';
 		}
 
 		$this->img()->setType('im');

+ 13 - 7
src/View.php

@@ -53,6 +53,12 @@ class View
                 }
             }
 
+            if ($type == 'wp') {
+                $temp = explode('.', $dest);
+                $dest = $temp[0] . '.webp';
+                $file = str_replace($root, $host, $dest);
+            }
+
             if (!strstr($dest, 'http://') && !is_file($dest)) {
                 $handle = new Handle();
                 $method = 'handle_' . $type;
@@ -74,18 +80,18 @@ class View
     {
         $type = $id = false;
 
-        if (strstr($file, '_c')) {
+        if (strstr($file, '_wp')) {
+            $array = explode('_wp', $file);
+            $type = 'wp';
+        } elseif (strstr($file, '_p')) {
+            $array = explode('_p', $file);
+            $type = 'p';
+        } elseif (strstr($file, '_c')) {
             $array = explode('_c', $file);
             $type = 'c';
         } elseif (strstr($file, '_t')) {
             $array = explode('_t', $file);
             $type = 't';
-        } elseif (strstr($file, '_p')) {
-            $array = explode('_p', $file);
-            $type = 'p';
-        } elseif (strstr($file, '_wp')) {
-            $array = explode('_wp', $file);
-            $type = 'wp';
         }
 
         if (isset($array)) {