[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Proper method of posting images?
> > Or use Image::Size to deliver the size of the images. I don't think this
> > would cause too much of a performance problem. I knocked up a usertag to
> > return the size in to two scratch vars. Mind you, I was then
> > storing them in
> > a database rather than using it on the fly. Docs say its
> suitable for that
> > though.
> >
> > Jonathan
> > Webmaint.
>
>
> Jonathan,
>
> Would you mind sharing your usertag?
no probs. its below.
If you just want to display the image, there is a usertag called [image]
which may also do the job. See the file image.tag for how to use it.
Jonathan
Webmaint.
===
# usertag image-size by jonc@webmaint.com (I think)
# sets the values width,height to the size of the image file..
# and puts it into scratch vars 'imgheight' and 'imgwidth'
#
# Requires perl module Image::Size
#
#
# example:
#
# [image-size file='/path/to/file.gif']
#
# adding show=1 will output a line of text which may be
# useful for debugging.
#
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