On 6 Apr 2003 at 10:13, Mike Blezien wrote:

> Hello.

Hello, Mike

> 
> hoping to find someone fimilar with using ImageMagick. I haven't used this too 
> much and need to get the image that's uploaded, it's pixel size(width x heigth)
> 
> I can do this using the Image::Size module, but I assume, somehow I do the same 
> the same using the ImageMagick too. In the docs it says to use the "Get()" 
> method,.. but I'm not real clear on how to get the image width and height from that.
> 
> thanks for any help ;)
> 
> -- 

I do exactly what you want to do in some of
my web sites; here's the code I use (works
fine). The code is set up for Mason, but you
can adjust it for general use:

<%perl>
        my $in = shift; # image file name
        my ($image, $warn);
        $image = Image::Magick->new;
        $warn = $image->Read ($in);
        if ($warn) {
                $m->comp ('/shared/_error' =>
"error getting size for image $in: $warn");
                return (0, 0);
                }
        my ($w, $h) = ($image->Get ('width'),
         $image->Get ('height'));
        $image = undef;
        return ($w, $h);
</%perl>

Aloha => Beau;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to