[pLog-svn] r4412 - in plog/trunk/class: gallery/dao net

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Dec 19 23:11:35 GMT 2006


Author: oscar
Date: 2006-12-19 23:11:35 +0000 (Tue, 19 Dec 2006)
New Revision: 4412

Modified:
   plog/trunk/class/gallery/dao/galleryresource.class.php
   plog/trunk/class/net/baserequestgenerator.class.php
Log:
added some missing code and fixed a couple of issues


Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresource.class.php	2006-12-19 22:48:32 UTC (rev 4411)
+++ plog/trunk/class/gallery/dao/galleryresource.class.php	2006-12-19 23:11:35 UTC (rev 4412)
@@ -371,17 +371,33 @@
 		 */
 		function getPreviewFileName()
 		{
-    		lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );		
+    		lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );	
 		
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) {
-				$previewFile = GalleryResourceStorage::getPreviewsFolder( $this->getOwnerId()).$this->getFileName();
+				$previewFile = $this->getFileName();
 			}
 			else {
-				throw( new Exception( "TODO: this case has not been implemented yet!" ));
+				$previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $this->getFileName());
 			}
 
 			return $previewFile;
 		}
+		
+		/**
+		 * @private
+		 */
+		function _getFileExtension()
+		{
+			$fileName = $this->getFileName();
+			if(( $extPos = strrpos( $fileName, "." )) !== false ) {					
+				$fileExt = substr( $fileName, $extPos+1, strlen( $fileName ));
+			}
+			else {
+				$fileExt = "";
+			}			
+			
+			return( $fileExt );
+		}
 
 		/**
 		 * returns the full path to the file with the medium-sized preview
@@ -393,10 +409,10 @@
 			lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );		
 		
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE ) {
-				$previewFile = GalleryResourceStorage::getMediumSizePreviewsFolder( $this->getOwnerId()).$this->getFileName();
+				$previewFile = $this->getFileName();
 			}
-			else {
-				throw( new Exception( "TODO: this case has not been implemented yet!" ));				
+			else {			
+				$previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $this->getFileName());
 			}
 
 			return $previewFile;

Modified: plog/trunk/class/net/baserequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/baserequestgenerator.class.php	2006-12-19 22:48:32 UTC (rev 4411)
+++ plog/trunk/class/net/baserequestgenerator.class.php	2006-12-19 23:11:35 UTC (rev 4412)
@@ -492,7 +492,7 @@
         function resourcePreviewLink( $resource )
         {
             $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());            
-			$resourceLink = $this->getBaseUrl()."/gallery/".$blogId."/previews/".$resource->getFileName();            
+			$resourceLink = $this->getBaseUrl()."/gallery/".$blogId."/previews/".$resource->getPreviewFileName();            
             return $resourceLink;
         }
 		
@@ -504,7 +504,7 @@
         function resourceMediumSizePreviewLink( $resource )
         {
             $blogId = ($resource->getOwnerId() ? $resource->getOwnerId() : $this->_blogInfo->getId());            
-			$resourceLink = $this->getBaseUrl()."/gallery/".$blogId."/previews-med/".$resource->getFileName();
+			$resourceLink = $this->getBaseUrl()."/gallery/".$blogId."/previews-med/".$resource->getMediumSizePreviewFileName();
             return $resourceLink;
 		}
 



More information about the pLog-svn mailing list