[ic] "if file-e" functionality in user tag?

Louie Martinez louie at kopykake.com
Fri Aug 5 20:32:47 EDT 2005

Jeff Boes wrote:
> I want to create a user tag that produces an "<img>" tag using some
> default attributes, and inserting a default image if the cited image is
> missing. But the "-e" check in Perl isn't allowed by Safe, so I tried:
> if ($Tag->if({ op => 'file-e', term => $file})) {
> This reports (at catalog initialization) --
> UserTag 'veh_thumb' subroutine failed safe check: Can't call method "if"
> on an undefined value at (eval 383) line 11, <CONFIG> line 45.

I needed something similar. I opted to use features in apache. I added this to my
httpd.conf file for my web store.

    <Directory "/path/to/store/htdocs/store/images/thumb">
        Options FollowSymLinks
        AllowOverride FileInfo Options
        Order allow,deny
        Allow from all

and then in /path/to/store/htdocs/store/images/thumb I created a .htaccess file and added this to it.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} (.*).(gif|jpg|jpeg)$
RewriteRule ^(.*) http://www.yourstore.com/store/images/thumb/unavailable.gif

If for some reason the thumbnail file is missing from the /thumb folder, it displays
/thumb/unavailable.gif instead

The same can be done to /path/to/your/store/htdocs/store/images/items

You need to make sure you have the mod_rewrite loaded. In slackware linux it looks like this in

LoadModule rewrite_module     libexec/apache/mod_rewrite.so

and then slightly further down it has the corresponding line...

AddModule mod_rewrite.c

Louie Martinez

Kopykake Enterprises
3699 W. 240th St
Torrance, CA 90505
(310) 373-8906
(800) 999-5253
FAX: (310) 375-5275

More information about the interchange-users mailing list