CGI-Application-PhotoGallery

 view release on metacpan or  search on metacpan

lib/CGI/Application/PhotoGallery/GD.pm  view on Meta::CPAN


sub load {
    my $self = shift;
    my $file = shift;

    my $image;
    if ( $GD::VERSION < 1.30 ) {
        my ( $path, $type ) = $file =~ /(.*)\.([^.]+)/;
        my %new = (
            gif => 'newFromGif',
            png => 'newFromPng',
            jpg => 'newFromJpeg'
        );
        my $new = $new{ lc( $type ) };
        $image = GD::Image->$new( $file );
    }
    else {
        $image = GD::Image->new( $file );
    }

    return $image;



( run in 0.779 second using v1.01-cache-2.11-cpan-0a6323c29d9 )