[FX.php List] Another image display question

Chris Bisgard chris at hotanvil.com
Fri Sep 21 13:57:18 MDT 2007


Thanks, Bob... Your solution works well, too.  

Chris

> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org 
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Bob Patin
> Sent: Friday, September 21, 2007 12:39 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Another image display question
> 
> Chris,
> 
> I've faced that same conundrum a lot of times; here's how I write the
> code:
> 
> <?php
> if (strlen($image_url)>0){
> ?>
> 	<img src="<?php echo $image_url; ?>">
> <?php
> }
> ?>
> 
> The other way to do this is to substitute a blank image, but 
> with the IF statement above it's not necessary.
> 
> Bob Patin
> Longterm Solutions
> bob at longtermsolutions.com
> 615-333-6858
> http://www.longtermsolutions.com
> Member of FileMaker Business Alliance and FileMaker TechNet
> 
>    CONTACT US VIA INSTANT MESSAGING:
>       AIM or iChat: longterm1954
>       Yahoo: longterm_solutions
>       MSN: tech at longtermsolutions.com
>       ICQ: 159333060
> 
> --------------------------
> Contact us for FileMaker hosting for all versions of 
> FileMaker PHP . CDML . Full email services . Free DNS hosting 
> . Colocation . Consulting
> 
> 
> 
> 
> 
> 
> On Sep 21, 2007, at 1:59 PM, Chris Bisgard 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