in reply to (jcwren) RE: RE: Re: GD Module
in thread GD Module
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
hmmmm
by dvst8 (Initiate) on Jun 20, 2000 at 23:03 UTC | |
I've gone through your code, and it all makes sense except for the confess stuff... what does that mean? I'm using PerlScript in an ASP page, and tried out your sub... here is what my page looks like:
| [reply] [d/l] |
|
hmmmm
by dvst8 (Initiate) on Jun 20, 2000 at 23:04 UTC | |
I've gone through your code, and it all makes sense except for the confess stuff... what does that mean? I'm using PerlScript in an ASP page, and tried out your sub... here is what my page looks like: <code> <%@ LANGUAGE = PerlScript my $globalPreviewMaxDimension = 100; sub util_photo_GenerateThumbnail { my ($source, $destination) = @_; my $preview = Image::Magick->new; my $x = $preview->Read ($source); confess "$x" if "$x"; my ($xSize, $ySize) = $preview->Get ('width', 'height'); # Get the pictures dimensions # # Calculate dimensions of thumbnail # my $scaleFactor; my $previewX; my $previewY; # # Only scale if either axis is larger than the preview size # if ($xSize > $globalPreviewMaxDimension || $ySize > $globalPreviewMaxDimension) { if ($xSize > $ySize) { $scaleFactor = $globalPreviewMaxDimension / $xSize; $previewX = $globalPreviewMaxDimension; $previewY = int ($ySize * $scaleFactor); } else { $scaleFactor = $globalPreviewMaxDimension / $ySize; $previewY = $globalPreviewMaxDimension; $previewX = int ($xSize * $scaleFactor); } $x = $preview->Scale (width=>$previewX, height=>$previewY); confess "$x" if "$x"; $xSize = $previewX; $ySize = $previewY; } % | [reply] |
|
hmmmm
by dvst8 (Initiate) on Jun 20, 2000 at 23:08 UTC | |
I've gone through your code, and it all makes sense except for the confess stuff... what does that mean? I'm using PerlScript in an ASP page, and tried out your sub... here is what my page looks like: <code> <%@ LANGUAGE = PerlScript my $globalPreviewMaxDimension = 100; sub util_photo_GenerateThumbnail { my ($source, $destination) = @_; my $preview = Image::Magick->new; my $x = $preview->Read ($source); confess "$x" if "$x"; my ($xSize, $ySize) = $preview->Get ('width', 'height'); # Get the pictures dimensions # # Calculate dimensions of thumbnail # my $scaleFactor; my $previewX; my $previewY; # # Only scale if either axis is larger than the preview size # if ($xSize > $globalPreviewMaxDimension || $ySize > $globalPreviewMaxDimension) { if ($xSize > $ySize) { $scaleFactor = $globalPreviewMaxDimension / $xSize; $previewX = $globalPreviewMaxDimension; $previewY = int ($ySize * $scaleFactor); } else { $scaleFactor = $globalPreviewMaxDimension / $ySize; $previewY = $globalPreviewMaxDimension; $previewX = int ($xSize * $scaleFactor); } $x = $preview->Scale (width=>$previewX, height=>$previewY); confess "$x" if "$x"; $xSize = $previewX; $ySize = $previewY; } % | [reply] |