Images.php
authorAlan Knowles <alan@roojs.com>
Wed, 23 May 2012 02:07:37 +0000 (10:07 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 23 May 2012 02:07:37 +0000 (10:07 +0800)
Images.php

index 97ea636..1f7c79d 100644 (file)
@@ -238,11 +238,14 @@ class Pman_Core_Images extends Pman
                 continue;
             }
             $type = explode('/', $umatch[1]);
-            $thumbsize = false;
-            $new_thumbsize = false;
+            $thumbsize = -1;
+            $new_thumbsize = -1;
             
             if (count($type) > 2 && $type[1] == 'Thumb') {
                 $thumbsize = $type[2];
+                $provider = 'Images/Thumb';
+            } else {
+                $provider = $type;
             }
             
             if (!empty($attr['width']) || !empty($attr['height']) )
@@ -261,6 +264,7 @@ class Pman_Core_Images extends Pman
                 if (!$new_thumbsize) {
                     $type = array('Image');
                 } else {
+                    
                     $type = array('Image', 'Thumb', $new_thumbsize);
                     
                     $fc = $img->toFileConvert();
@@ -272,6 +276,15 @@ class Pman_Core_Images extends Pman
             }
             
             
+            // finally replace the original TAG with the new version..
+            $old_src_tag = 'src="'. $attr[src] . '"';
+            $img = str_replace(
+                'src="'. $attr[src] . '"',
+                $img->URL($new_thumbsize , $provider, $baseURL=false)
+                'src="'. $baseURL + implode('/', $type) . '/' . urlencode($img->filename)"', 
+            
+            
+            
             
             
             // make an image url..