Author: uncleringo
Date: 2010-03-02 14:18:36 +0100 (Tue, 02 Mar 2010)
New Revision: 28342

Modified:
   plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
Log:
Fixed fatal bug when uploading new image



Modified: plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
===================================================================
--- plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php        
2010-03-02 13:15:35 UTC (rev 28341)
+++ plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php        
2010-03-02 13:18:36 UTC (rev 28342)
@@ -306,6 +306,11 @@
 
     $img->resize(400, null);
     $img->saveAs($dir . DIRECTORY_SEPARATOR . $editable);
+
+    $this->getInvoker()->{$fieldName . '_x1'} = 0;
+    $this->getInvoker()->{$fieldName . '_y1'} = 0;
+    $this->getInvoker()->{$fieldName . '_x2'} = $img->getWidth();
+    $this->getInvoker()->{$fieldName . '_y2'} = $img->getHeight();
   }
   
   /**
@@ -445,12 +450,12 @@
     
     $origCrop = $this->originalImages[$fieldName]
       ->crop($dims['x'], $dims['y'], $dims['w'], $dims['h']);
-      
+
     $finalCrop = $origCrop->resize(
       $imageConfig['sizes'][$size]['width'],
       empty($imageConfig['ratio']) ?
         null :
-        $imageConfig['sizes'][$size]['width'] / $imageConfig['ratio']);
+        round($imageConfig['sizes'][$size]['width'] / $imageConfig['ratio']));
     
     $fullPath = $this->getImageDir() . DIRECTORY_SEPARATOR . 
$this->getImageFromName($fieldName, $size);
     

-- 
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