Author: Jonathan.Wage
Date: 2010-01-14 05:09:25 +0100 (Thu, 14 Jan 2010)
New Revision: 26607

Modified:
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/doctrine/PluginsfSympalAsset.class.php
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/types/sfSympalAssetImageObject.class.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing asset thumbnail generation


Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/doctrine/PluginsfSympalAsset.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/doctrine/PluginsfSympalAsset.class.php
      2010-01-14 04:00:12 UTC (rev 26606)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/doctrine/PluginsfSympalAsset.class.php
      2010-01-14 04:09:25 UTC (rev 26607)
@@ -75,18 +75,19 @@
     return parent::delete($conn);
   }
 
-  public function save(Doctrine_Connection $conn = null)
+  public function preUpdate($event)
   {
     $this->getAssetObject()->save();
-    $isNew = $this->isNew();
-    $result = parent::save($conn);
+  }
 
-    if ($isNew)
-    {
-      $this->copyOriginal();
-    }
+  public function preInsert($event)
+  {
+    $this->getAssetObject()->save();
+  }
 
-    return $result;
+  public function postInsert($event)
+  {
+    $this->copyOriginal();
   }
 
   public function copyOriginal()

Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/types/sfSympalAssetImageObject.class.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/types/sfSympalAssetImageObject.class.php
    2010-01-14 04:00:12 UTC (rev 26606)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalAssetsPlugin/lib/model/types/sfSympalAssetImageObject.class.php
    2010-01-14 04:09:25 UTC (rev 26607)
@@ -72,7 +72,12 @@
 
   public function getThumbnailUrl()
   {
-    return $this->getThumbnail()->getUrl();
+    if ($thumbnail = $this->getThumbnail())
+    {
+      return $thumbnail->getUrl();
+    } else {
+      return null;
+    }
   }
 
   public function move($newPath)
@@ -143,13 +148,8 @@
     }
   }
 
-  public function postInsert(sfEvent $event)
+  public function save()
   {
     $this->_generateThumbnail();
   }
-
-  public function postUpdate(sfEvent $event)
-  {
-    $this->_generateThumbnail();
-  }
 }
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to