[pLog-svn] r2151 - plog/branches/plog-1.0.2/class/action/admin
jondaley at devel.plogworld.net
jondaley at devel.plogworld.net
Wed Jun 1 01:35:58 GMT 2005
Author: jondaley
Date: 2005-06-01 01:35:58 +0000 (Wed, 01 Jun 2005)
New Revision: 2151
Modified:
plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php
Log:
untabified
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 00:38:58 UTC (rev 2150)
+++ plog/branches/plog-1.0.2/class/action/admin/adminregeneratepreviewaction.class.php 2005-06-01 01:35:58 UTC (rev 2151)
@@ -1,93 +1,91 @@
<?php
- include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
- include_once( PLOG_CLASS_PATH."class/view/admin/admineditresourceview.class.php" );
- include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
- include_once( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
- include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
+include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+include_once( PLOG_CLASS_PATH."class/view/admin/adminresourceslistview.class.php" );
+include_once( PLOG_CLASS_PATH."class/view/admin/admineditresourceview.class.php" );
+include_once( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+include_once( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );
+include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
+include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );
/**
* \ingroup Action
* @private
- */
- class AdminRegeneratePreviewAction extends AdminAction
- {
-
- var $_resourceId;
-
- function AdminRegeneratePreviewAction( $actionInfo, $request )
- {
- $this->AdminAction( $actionInfo, $request );
-
- $this->registerFieldValidator( "resourceId", new IntegerValidator());
- $view = new AdminResourcesListView( $this->_blogInfo );
- $view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
- $this->setValidationErrorView( $view );
+ */
+class AdminRegeneratePreviewAction extends AdminAction
+{
+
+ var $_resourceId;
+
+ function AdminRegeneratePreviewAction( $actionInfo, $request ){
+ $this->AdminAction( $actionInfo, $request );
+
+ $this->registerFieldValidator( "resourceId", new IntegerValidator());
+ $view = new AdminResourcesListView( $this->_blogInfo );
+ $view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
+ $this->setValidationErrorView( $view );
+ }
+
+ function perform(){
+ // first of all, fetch the resource
+ $this->_resourceId = $this->_request->getValue( "resourceId" );
+ $resources = new GalleryResources();
+ $resource = $resources->getResource( $this->_resourceId, $this->_blogInfo->getId());
+
+ // check if it was loaded ok
+ if( !$resource ) {
+ $this->_view = new AdminResourcesListView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
+ $this->setCommonData();
+
+ return false;
}
-
- function perform()
- {
- // first of all, fetch the resource
- $this->_resourceId = $this->_request->getValue( "resourceId" );
- $resources = new GalleryResources();
- $resource = $resources->getResource( $this->_resourceId, $this->_blogInfo->getId());
-
- // check if it was loaded ok
- if( !$resource ) {
- $this->_view = new AdminResourcesListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_loading_resource"));
- $this->setCommonData();
-
- return false;
- }
-
- // if so, continue... first by checking if the resource is an image or not
- // because if not, then there is no point in generating a thumbnail of it!
- if( !$resource->isImage()) {
- $this->_view = new AdminResourcesListView( $this->_blogInfo );
- $this->_view->setErrorMessage( $this->_locale->tr("error_resource_is_not_an_image" ));
- }
-
-
- $previewHeight = $this->_config->getValue( "thumbnail_height" );
- $previewWidth = $this->_config->getValue( "thumbnail_width" );
- $previewKeepAspectRatio = $this->_config->getValue( "thumbnails_keep_aspect_ratio" );
+
+ // if so, continue... first by checking if the resource is an image or not
+ // because if not, then there is no point in generating a thumbnail of it!
+ if( !$resource->isImage()) {
+ $this->_view = new AdminResourcesListView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_resource_is_not_an_image" ));
+ }
+
+
+ $previewHeight = $this->_config->getValue( "thumbnail_height" );
+ $previewWidth = $this->_config->getValue( "thumbnail_width" );
+ $previewKeepAspectRatio = $this->_config->getValue( "thumbnails_keep_aspect_ratio" );
- // build the filename
- $fileNameParts = explode( ".", $resource->getFileName());
- $fileExt = strtolower($fileNameParts[count($fileNameParts)-1]);
- $fileName = $resource->getOwnerId()."-".$resource->getId().".".$fileExt;
+ // build the filename
+ $fileNameParts = explode( ".", $resource->getFileName());
+ $fileExt = strtolower($fileNameParts[count($fileNameParts)-1]);
+ $fileName = $resource->getOwnerId()."-".$resource->getId().".".$fileExt;
- // and start the resizing process
- $resourceStorage = new GalleryResourceStorage();
- $resizer = new GalleryResizer( $resourceStorage->getResourcePath( $resource ));
- $resourceStorage->checkPreviewsStorageFolder( $resource->getOwnerId());
- $outFile = $resourceStorage->getPreviewsFolder( $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_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 );
- }
-
- $this->setCommonData();
-
- return true;
- }
- }
+ // and start the resizing process
+ $resourceStorage = new GalleryResourceStorage();
+ $resizer = new GalleryResizer( $resourceStorage->getResourcePath( $resource ));
+ $resourceStorage->checkPreviewsStorageFolder( $resource->getOwnerId());
+ $outFile = $resourceStorage->getPreviewsFolder( $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_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 );
+ }
+
+ $this->setCommonData();
+
+ return true;
+ }
+}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list