[pLog-svn] r6457 - plog/trunk/class/gallery/dao
mark at devel.lifetype.net
mark at devel.lifetype.net
Wed May 14 03:03:21 EDT 2008
Author: mark
Date: 2008-05-14 03:03:21 -0400 (Wed, 14 May 2008)
New Revision: 6457
Modified:
plog/trunk/class/gallery/dao/galleryresource.class.php
Log:
Fixed the lower/upper case error of original file name extension.
Before 1.1, we used original file extension without any modification. After 1.1, we convert all the extension to lower case.
So, if user upgrade from 1.0->1.1->1.2, they will get problems about those old files.
The best way to solve the problem is use File::isReadable to check file exist or not, if the file does not exist, we use the old way to get the file.
Todo: Maybe we can add a system image "lost.jpg", so we just return the lost.jpg if both files not exist.
Modified: plog/trunk/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresource.class.php 2008-05-14 06:58:19 UTC (rev 6456)
+++ plog/trunk/class/gallery/dao/galleryresource.class.php 2008-05-14 07:03:21 UTC (rev 6457)
@@ -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;
}
@@ -465,13 +469,17 @@
*/
function getOriginalSizeFileName()
{
-
-
$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