Apache2-Imager-Resize

 view release on metacpan or  search on metacpan

lib/Apache2/Imager/Resize.pm  view on Meta::CPAN

        }

        if ($img_args{qtype}) {
            $shrunk .= "_qtype".$img_args{qtype};
        }

        $shrunk .= $suffix;

        if (file_ok( $shrunk, $filename )) {
            $r->filename($shrunk);
            $r->finfo(APR::Finfo::stat($shrunk, APR::Const::FINFO_NORM, $r->pool));
            my $mtime = (stat( $shrunk ))[9];
            utime time, $mtime, $shrunk;
            return OK;
        }

        # if we're using a separate cache directory, the necessary subdirectory might not exist yet

        if ($cachedir) {
            eval {  File::Path::mkpath($path) };
            return fail( "mkpath failed for '$path': $@" ) if $@;
        }

lib/Apache2/Imager/Resize.pm  view on Meta::CPAN

    # otherwise we write out the cache file and tell the request to use that filename

    } else {

        $im->write(
            file => $shrunk,
            jpegquality => $quality,
        ) or return fail("Cannot write $shrunk: " . $im->errstr);

        $r->filename($shrunk);
        $r->finfo(APR::Finfo::stat($shrunk, APR::Const::FINFO_NORM, $r->pool));
        return OK;
    }
}

sub resize {
    my $im = shift;
    my $args = shift;

    my $imgwidth = $im->getwidth;
    my $imgheight = $im->getheight;



( run in 1.079 second using v1.01-cache-2.11-cpan-49f99fa48dc )