Re: Re: file_Exists() and case
| From: | Stut | Date: | Sun, 23 Nov 2008 19:03:21 +0000 |
| Subject: | Re: Re: file_Exists() and case | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-283744@lists.php.net to get a copy of this message | ||
On 23 Nov 2008, at 18:53, Stan wrote:
Let me attack this in a different way. This started because my camera names files whatever.JPG and my thumbnail generator generates thumbnail files whatever.jpg. Given my workstation (upon which I edit code and run a web browser) is W2K and my web server is APACHE2 on UBUNTU, I sometimes have to run out back and scream to maintain my sanity. I do not want whoever (my wife, my kids, maybe even my grandkids) to have to manually change either picture file extensions or generated thumbnail extensions on a mass of pictures they're trying to add to our web site ... over the Internet in some cases. I was attempting to avoid the overhead of generating thumbnails on the fly as I construct a page of thumbnails related to a specific event or subject because I don't know how many thumbnails may be rendered. The subject on which I encountered this problem (for the second time this week) has something in the order of 250 pictures (in several different directories). What I'd really like to be able to do is to detect, programmatically, FOR SURE and FOR CERTAIN, that a specific file exists BEFORE I generate the anchor tag that contains the thumbnail ... given that every image file has a thumbnail file in a different directory than the image file. I need to try the file identifier from which the thumbnail file identifier was derived and, that failing, try changing the extension. If I can't find it I don't want to put up the thumbnail. How can I do that, please? Do what? Detect, programmatically, FOR SURE and FOR CERTAIN, that a specific file exists.I don't see the problem. For a start file_exists will do exactly what you're asking for. It will tell you "programatically, FOR SURE and FOR CERTAIN, that a specific file exists". That's what it does. I don't understand why you don't generate the thumbnails to have *exactly* the same filename as the actual image. And if you really have to give it a different name, or different case, surely you know the rules around how that works so you can build that logic in when checking for the existence of a file. Or maybe I'm missing something. -Stut -- http://stut.net/