[pLog-svn] r6808 - plog/branches/lifetype-1.2/class/gallery/dao

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat Feb 21 07:14:59 EST 2009


Author: jondaley
Date: 2009-02-21 07:14:58 -0500 (Sat, 21 Feb 2009)
New Revision: 6808

Modified:
   plog/branches/lifetype-1.2/class/gallery/dao/
   plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php
Log:
backported Mark's encoding fix from rev 6457 from trunk.  I would have rather fixed the wizard, but I'd like to get 1.2.9 released.


Property changes on: plog/branches/lifetype-1.2/class/gallery/dao
___________________________________________________________________
Added: svn:mergeinfo
   + /plog/trunk/class/gallery/dao:6457


Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php	2009-02-18 18:59:39 UTC (rev 6807)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php	2009-02-21 12:14:58 UTC (rev 6808)
@@ -201,11 +201,15 @@
 		/**
 		 * @return the encoded name of the file in disk
 		 */
-        function getEncodedFileName()
+        function getEncodedFileName( $encodeExtension = true )
         {
             $fileParts = explode( ".", $this->_fileName );
-            $fileExt = strtolower($fileParts[count($fileParts)-1]);
-            $encodedFileName = $this->getOwnerId()."-".$this->getId().".".$fileExt;
+			if( $encodeExtension )
+				$fileExt = strtolower($fileParts[count($fileParts)-1]);
+			else
+				$fileExt = $fileParts[count($fileParts)-1];
+ 
+			$encodedFileName = $this->getOwnerId()."-".$this->getId().".".$fileExt;
         	return $encodedFileName;
         }
 
@@ -471,12 +475,17 @@
 		function getOriginalSizeFileName()
 		{
 			lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );		
-		
 			$config =& Config::getConfig();
 
 			// encoding the filename if "encoded_file_name" enabled
 			if( $config->getValue( "resources_naming_rule" ) == "encoded_file_name" )
+			{
+				$storage = new GalleryResourceStorage();
+				$filePath = $storage->getUserFolder( $this->getOwnerId() );
 				$fileName = $this->getEncodedFileName();
+				if( !File::isReadable( $filePath.$fileName ) )
+					$fileName = $this->getEncodedFileName( false );
+			}
 			else
 				$fileName = $this->getFileName();
 			



More information about the pLog-svn mailing list