[FX.php List] Another image display question

Chris Bisgard chris at hotanvil.com
Fri Sep 21 13:56:27 MDT 2007


(Slapping forehead) Duh, of course! PERFECT! That's exactly what I needed.
Thanks!

Chris

> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org 
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of 
> Gjermund Gusland Thorsen
> Sent: Friday, September 21, 2007 12:11 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Another image display question
> 
> I suggest you use this function to check if the file exists:
> 
> http://www.php.net/manual/en/function.file-exists.php
> 
> if( ! file_exists( $query['record_ID'][0] . '.jpg' ) ) {
>     // don't display the image tag
> } else {
>     // display the image tag
> }
> 
> ggt667
> 
> On 9/21/07, Chris Bisgard <chris at hotanvil.com> wrote:
> >
> >
> > Hi all,
> >
> > I have a FileMaker solution in which my images are stored 
> externally 
> > from the database at a web-accessible location, and I am 
> using a web 
> > viewer window to load them in FM layouts (i.e: no container 
> field). We 
> > use a strict image naming convention so that the filenames match a 
> > unique ID number for each record in the database. There is 
> not always 
> > an image for every record, and because it's not desirable 
> to see the 
> > default 404 page in the web viewer when there isn't one, I 
> have set up 
> > a custom 404 page for my image that just says "Image Not Available" 
> > for my FM clients. This is all working fine.
> >
> > However, this database is also searchable on the web, which 
> I have set 
> > up using FX.php. I can query for the record ID and use it 
> to generate 
> > the URL to the correct image file, like this:
> >
> > print "<img src=\"http://mysite.com/images/" . 
> $query['record_ID'][0] .
> > ".jpg\">";
> >
> > The problem is that I don't want web users to see a "broken image" 
> > icon when there's no image at that location. I would rather 
> just not 
> > have the IMG tag appear at all in that case. In the past, we used 
> > embedded images in container fields... not an ideal 
> solution, but it 
> > did make it easy to just check for image data like this:
> >
> > if ( $query['imageContainer'][0] == '' ) {
> >     // don't display the image tag
> > } else {
> >     // display the image tag
> > }
> >
> > But with this new improved setup, I don't have a container 
> field to check.
> > How can I check to see if there's an image file there at the URL 
> > defined by the record ID? Is there a PHP function that can check to 
> > see if an HTTP request for the image comes back 404? Or is 
> there a way 
> > to have FileMaker test for the presence of an external file 
> and return 
> > an error code I could trap for?
> >
> > Thanks for any help or advice, as always.
> >
> > Chris Bisgard
> > Information Technology Specialist
> > Regional Arts & Culture Council
> > 108 NW 9th Avenue, Suite 300
> > Portland, Oregon 97209-3318
> >
> > _______________________________________________
> > FX.php_List mailing list
> > FX.php_List at mail.iviking.org
> > http://www.iviking.org/mailman/listinfo/fx.php_list
> >
> >
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 



More information about the FX.php_List mailing list