DataObjects/Core_notify.php
[Pman.Core] / DataObjects / Images.php
index 8148116..6279e0c 100644 (file)
@@ -58,29 +58,28 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
     {
         if (isset($q['_remote_upload'])) {
             require_once 'System.php';
-            static $tmpdir = false;
-            if (!$tmpdir) {
-                $tmpdir  = System::mktemp("-d remote_upload");
-            }
+            
+            $tmpdir  = System::mktemp("-d remote_upload");
             
             $path = $tmpdir . '/' . basename($q['_remote_upload']);
             
             if(!file_exists($path)){
-                // use HTTP_Request...
                file_put_contents($path, file_get_contents($q['_remote_upload'])); 
             }
             
             $imageInfo = getimagesize($path);
+            
             require_once 'File/MimeType.php';
             $y = new File_MimeType();
             $ext = $y->toExt(trim((string) $imageInfo['mime'] ));
             
             if (!preg_match("/\." . $ext."$/", $path, $matches)) {
-                rename($path,$path.$ext);
+                rename($path,$path.".".$ext);
+                $path.= ".".$ext;
             }
             
             if (!$this->createFrom($path)) {
-                $roo->jerr("erro making image" . $q['_remote_upload'] . "??? " . ((int) $fetch));
+                $roo->jerr("erro making image" . $q['_remote_upload']);
             }
             
             $roo->addEvent("ADD", $this, $this->toEventString());