DataObjects/core.sql
[Pman.Core] / DataObjects / Images.php
index 8b2dd9c..86c1e77 100644 (file)
@@ -115,9 +115,12 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
         $f = $this->getStoreName();
         $dest = dirname($f);
         if (!file_exists($dest)) {
-            
+            // currently this is 0775 due to problems using shared hosing (FTP)
+            // it makes all the files unaccessable..
+            // you can normally solve this by giving the storedirectory better perms
+            // if needed on a dedicated server..
             $oldumask = umask(0);
-            mkdir($dest, 0770, true);
+            mkdir($dest, 0775, true);
             umask($oldumask);  
         }
         
@@ -345,7 +348,14 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
       //  echo '<PRE>';print_r($req);exit;
         $ret= $this->toArray();
       
-      
+        static $ff = false;
+        if (!$ff) {
+            $ff = HTML_FlexyFramework::get();
+        }
+        
+        $ret['public_baseURL'] = isset($ff->Pman_Images['public_baseURL']) ?
+                    $ff->Pman_Images['public_baseURL'] : $ff->baseURL;
+        
         if (!empty($req['query']['imagesize'])) {
              $baseURL = isset($req['query']['imageBaseURL']) ? $req['query']['imageBaseURL'] : false;
             
@@ -379,10 +389,10 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
 
         $ff = HTML_FlexyFramework::get();
         $baseURL = $baseURL ? $baseURL : $ff->baseURL ;
-        if preg_match('#^http[s]*://#', $provider)) {
+        if (preg_match('#^http[s]*://#', $provider)) {
             $baseURL = '';
         }
-        
+       
         if ($size < 0) {
             return $baseURL . $provider . "/{$this->id}/{$this->filename}";
         }
@@ -418,13 +428,25 @@ class Pman_Core_DataObjects_Images extends DB_DataObject
             $sy = $sz[1];
         }
         // create it?
-        
-        
+         
         return '<img src="' . $this->URL($size, $provider) . '" width="'. $sx . '" height="'. $sy . '">';
         
         
     }
-    
+     
+    /**
+     * to Fileconvert object..
+     *
+     *
+     *
+     */
+    function toFileConvert()
+    {
+        require_once 'File/Convert.php';
+        $fc = new File_Convert($this->getStoreName(), $this->mimetype);
+        return $fc;
+        
+    }
     /**
      *
      *