[ic] howto do if file exists

Nicholas Cook interchange-users@icdevgroup.org
Wed Apr 16 21:51:01 2003


Currently I have the following in my results page.

<td width=86>
    <a href="[area [item-code]]">
       [if-item-field thumb]
          <img border="0" src="thumb/[item-field thumb]">
       [else]
          <img border="0" src="thumb/80.gif">
       [/else]
       [/if-item-field]
    </a>
</td>

My question is how would you do "If file exists" instead of the above 
if-field exists?  In other words, I want to test if the image file 
exists, and if so display the image.  If not, display the default image.

The other question with this is if I can do a "if file exists" clause, 
how resource intensive is that.  If people feel that this would be too 
slow, what other solutions do people know of. (The only other one I can 
think of is to setup a crontab entry to update specific fields in the 
database nightly, according to the contents of specific directories.)

Thank you,
Nicholas Cook