Re: Re: file_Exists() and case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 Nov 2008, at 14:41, Stan wrote:
Shouting is something that happens when people are actually speaking and listening. In a medium where there is no other way to emphasize salient
points in a message, capitalization is all that works.  I'm sorry it
offended your sensabilities.

It's actually well-established that capital letters indicate shouting. To emphasise words or phrases you should surround them with _ or *. The is also common practice.

realpath() fails, just like file_exists() fails, to report the file as
non-existant.

echo "realpath(\$basePicture) returns '" . realpath($basePicture) .
"'<br>\n";
echo "when \$basePicture is '" . $basePicture . "'<br>\n";
-------------------------------------------------------------------
generates
-------------------------------------------------------------------
realpath($basePicture) returns '/Stan-and-Jeanne.com/pictures/2008 west
coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg'
when $basePicture is '../pictures/2008 west coast trip/2008-06-10 first week
at Chris'/DSC_0011.jpg'
-------------------------------------------------------------------
but ls DSC_0011.* in ../pictures/2008 west coast trip/2008-06-10 first week
at Chris' returns only
-------------------------------------------------------------------
DSC_0011.JPG
-------------------------------------------------------------------
and
-------------------------------------------------------------------
try {$image = new IMagick($basePicture);
} catch (Exception $e) {
   echo 'Caught exception: ',  $e->getMessage(), "\n";
}
-------------------------------------------------------------------
results in
-------------------------------------------------------------------
Caught exception: unable to open image `/Stan-and-Jeanne.com/ pictures/2008 west coast trip/2008-06-10 first week at Chris'/DSC_0011.jpg': No such file
or directory
-------------------------------------------------------------------
so ... the following takes care of the extension problem in a very time
expensive way
-------------------------------------------------------------------
try
{
$image = new IMagick($basePicture);
}
catch (Exception $e)
{
$basePicture =
 substr($basePicture, 0, strrpos($basePicture, ".")) .
 "." .
 strtoupper(substr($basePicture, strrpos($basePicture, ".") + 1));
}
unset($image);
-------------------------------------------------------------------
I don't actually consider this solved and I'll return to it after everything
else at least works.

Now I can proceed to my next problem.

You never answered one of my questions. Where are you getting $basePicture from? Why does it differ in case from the actual file on disk. If you ask me you'd be better off trying to resolve this problem further upstream at the point where the case gets changed but your workflow doesn't appear to notice it.

-Stut

--
http://stut.net/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux