[pLog-svn] r6256 - plog/branches/lifetype-1.2/class/action/admin

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Fri Mar 21 15:12:33 EDT 2008


Author: jondaley
Date: 2008-03-21 15:12:33 -0400 (Fri, 21 Mar 2008)
New Revision: 6256

Modified:
   plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
Log:
delete the old thumbnail (most important when the thumbnail method has changed) and update thumbnail format in resource

Modified: plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php	2008-03-21 19:11:58 UTC (rev 6255)
+++ plog/branches/lifetype-1.2/class/action/admin/adminregeneratepreviewaction.class.php	2008-03-21 19:12:33 UTC (rev 6256)
@@ -75,7 +75,15 @@
         lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
         lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
         $config =& Config::getConfig();
-        
+
+
+            // delete the small thumbnail
+        $previewFile = GalleryResourceStorage::getPreviewsFolder($resource->getOwnerId()) .
+            $resource->getPreviewFileName();
+        if( File::isReadable($previewFile))
+            File::delete($previewFile);
+
+            // create the new small thumbnail
         $previewHeight = $config->getValue( "thumbnail_height",
                                             GALLERY_DEFAULT_THUMBNAIL_HEIGHT );
         $previewWidth  = $config->getValue( "thumbnail_width",
@@ -93,7 +101,13 @@
             return false;
         }
 
-        
+            // delete the medium thumbnail
+        $previewFile = GalleryResourceStorage::getMediumSizePreviewsFolder(
+            $resource->getOwnerId()) . $resource->getMediumSizePreviewFileName();
+        if( File::isReadable($previewFile))
+            File::delete($previewFile);
+
+            // create the new medium thumbnail
         $previewHeight = $config->getValue( "medium_size_thumbnail_height",
                                                GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT );
         $previewWidth  = $config->getValue( "medium_size_thumbnail_width",
@@ -107,11 +121,17 @@
         if( !$result ) {
             $this->_view = new AdminEditResourceView( $this->_blogInfo );
             $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
+            $this->setCommonData($resource);
+            return false;
         }
-        else {
-            $this->_view = new AdminEditResourceView( $this->_blogInfo );
-            $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
-        }
+
+            // set new preview format
+        $resource->setThumbnailFormat(
+            $config->getValue("thumbnail_format", THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE));
+        $resources->updateResource( $resource );
+        
+        $this->_view = new AdminEditResourceView( $this->_blogInfo );
+        $this->_view->setSuccessMessage( $message = $this->_locale->tr("resource_preview_generated_ok" ));
         $this->setCommonData($resource);
             
         return true;



More information about the pLog-svn mailing list