CGI-Application-PhotoGallery
    
    
  
  
  
view release on metacpan or search on metacpan
lib/CGI/Application/PhotoGallery/GD.pm view on Meta::CPAN
sub new {
    my $class = shift;
    my $self  = {};
    bless $self, $class;
    return $self;
}
=head2 resize( $file, $size )
Resizes C<$file> to C<$size>xC<$size> with transparent margins.
=cut
sub resize {
    my $self = shift;
    my $file = shift;
    my $size = shift;
    my $image = $self->load( $file );
    my ( $width, $height ) = $image->getBounds();
    my $image2 = new GD::Image( $size, $size );
    $image2->transparent( $image2->colorAllocate( 0, 0, 0 ) );
    my $hnw = int( ( $height * $size / $width ) + 0.5 );
    my $wnh = int( ( $width * $size / $height ) + 0.5 );
    my @arg = ( $image, 0, 0, 0, 0, $size, $size, $width, $height );
    if ( $width > $height ) {
        $arg[ 2 ] = int( ( $size - $hnw ) / 2 + 0.5 );
        @arg[ 5, 6 ] = ( $size, $hnw );
    }
    
  
  
  lib/CGI/Application/PhotoGallery/Magick.pm view on Meta::CPAN
sub new {
    my $class = shift;
    my $self  = {};
    bless $self, $class;
    return $self;
}
=head2 resize( $file, $size )
Resizes C<$file> to C<$size>xC<$size> with transparent margins.
=cut
sub resize {
    my $self = shift;
    my $file = shift;
    my $size = shift;
    my $image = $self->load( $file );
    
  
  
  
( run in 0.345 second using v1.01-cache-2.11-cpan-a1d94b6210f )