Re: file_Exists() and case

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

 



Stut,
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.

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.

Thanks to all,
Stan



-- 
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