[ic] Image Size Usertag

Grant listbox at email.com
Wed Sep 17 17:27:59 EDT 2003


> Hi Grant,
> unfortunately the imagesize usertag still doesn't work. As I  said I
> had installed the ImageSize perl module.
> this is the code I've included in my catalog.cfg
>
> Require module Image::Size
>
> UserTag image_size Order file show
> UserTag image_size Routine <<EOR
> sub {
>         use Image::Size;
>
>         my ($file,$show) = @_;
>         my ($width,$height) = imgsize($file);
>
>         $Scratch->{imgwidth} = $width;
>         $Scratch->{imgheight} = $height;
>
>         return "size of file ($file) w=$width h=$height" if $show;
>         undef;
> }
> EOR
>
> tell me if you have any idea.
> thanks a lot.
> danilo
>
> Grant wrote:
>
> >>Hi,
> >>I've added the Image Size Usertag qo my catalog.cfg, and I've installed
> >>the latest ImageSize perl library (Image-Size-2.992.tar.gz) but when I
> >>restart IC I get this error
> >>-------------------------------------
> >>Configuring catalog ab...Using MySQL, DSN=dbi:mysql:ab...UserTag
> >>'image_size' subroutine failed safe check: require trapped by operation
> >>mask at (eval 138) line 2, <CONFIG> line 29.
> >>
> >>In line 29 of the configuration file 'etc/imagesize.usertag':
> >>UserTag image_size Routine <<EOR
> >>---------------------------------------
> >>
> >>Anyone can help me to solve this problem?
> >>
> >>I'll continue to look but I'll appreciate any help.
> >>thanks
> >>Danilo
> >>
> >>
> >
> >I use that tag.  Let me know if you still can't get it to work
> and I'll see
> >if I can help.
> >
> >- Grant

Danilo,
Here's the tag I'm using and it works great:

Usertag image-size Order file show
Usertag image-size Routine <<EOR
sub {

        use Image::Size;

        my ($file,$show)=@_;
        my ($width,$height);

        ($width,$height) = imgsize($file);

        $Scratch->{imgwidth}=$width;
        $Scratch->{imgheight}=$height;

        return "size of file ($file) w=$width h=$height" if $show;
        return;
}
EOR

I've got it installed in the global UserTag folder, not in catalog.cfg like
you mentioned you're doing.  Are you using a shared IC installation?  Also,
I remember getting really frustrated trying to figure out what path to
define to my images, but I finally got it figured out with the list's help.
Here's how I call the tag:

[image-size file='/user/httpdocs__IMAGE_DIR__/items/[item-code].jpg']

- Grant



More information about the interchange-users mailing list