[pLog-svn] r2152 - plog/branches/plog-1.0.2/class/action/admin

jondaley at devel.plogworld.net jondaley at devel.plogworld.net
Wed Jun 1 02:01:22 GMT 2005


Author: jondaley
Date: 2005-06-01 02:00:34 +0000 (Wed, 01 Jun 2005)
New Revision: 2152

Modified:
   plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php
Log:
regenerate medium sized preview whenever we regenerate the small preview

Modified: plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php
===================================================================
--- plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php	2005-06-01 01:35:58 UTC (rev 2151)
+++ plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php	2005-06-01 02:00:34 UTC (rev 2152)
@@ -76,13 +76,34 @@
             $this->_view->setErrorMessage( $this->_locale->tr("error_generating_resource_preview" ));
         }
         else {
-            $this->_view = new AdminEditResourceView( $this->_blogInfo );
-            $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
-            $this->_view->setValue( "resourceDescription", $resource->getDescription());
-            $this->_view->setValue( "albumId", $resource->getAlbumId());
-            $this->_view->setValue( "resource", $resource );
+            $previewHeight = $this->_config->getValue( "medium_size_thumbnail_height" );
+            $previewWidth  = $this->_config->getValue( "medium_size_thumbnail_width" );
+            
+                // and start the resizing process
+            $resourceStorage = new GalleryResourceStorage();
+            $resizer = new GalleryResizer( $resourceStorage->getResourcePath( $resource ));
+            $resourceStorage->checkMediumSizePreviewsStorageFolder( $resource->getOwnerId());
+            $outFile = $resourceStorage->getMediumSizePreviewsFolder( $resource->getOwnerId()).$fileName;
+            
+                // and finally, we can generate the preview!
+            $result = $resizer->generate( $outFile, $previewHeight, $previewWidth, $previewKeepAspectRatio );
+            
+            $previewFormat = $resizer->getThumbnailFormat();
+            $resource->setThumbnailFormat( $previewFormat );
+            $resources->updateResource( $resource );
+
+            if( !$result ) {
+                $this->_view = new AdminResourcesListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_generating_resource_medium" ));
+            }
+            else {
+                $this->_view = new AdminEditResourceView( $this->_blogInfo );
+                $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
+                $this->_view->setValue( "resourceDescription", $resource->getDescription());
+                $this->_view->setValue( "albumId", $resource->getAlbumId());
+                $this->_view->setValue( "resource", $resource );
+            }
         }
-            
         $this->setCommonData();
             
         return true;




More information about the pLog-svn mailing list