AxKit-App-Gallery
view release on metacpan or search on metacpan
lib/AxKit/App/Gallery/Plugin.pm view on Meta::CPAN
my $cachedfile = "$cachepath/$size.jpg";
$cachedfile = uri_unescape($cachedfile);
# $r->log_error("Cachedfile is $cachedfile");
my $image = Imager->new();
if(! -f $cachedfile
|| -z $cachedfile
|| (stat($r->filename()))[9] > (stat($cachedfile))[9]) {
# $r->log_error("will open " . $r->filename());
$image->open(file => $r->filename())
or die $image->errstr();
# $r->log_error("opened original image");
my($w, $h) = ($image->getwidth(), $image->getheight());
my $quality = $r->dir_config('GalleryThumbQuality');
lib/AxKit/App/Gallery/Provider.pm view on Meta::CPAN
# $r->log_error("get_strref() called: file: " . $r->filename() . " type: " . $r->content_type());
# $r->log_error(Dumper($r));
return $self->SUPER::get_strref() if ! -f $r->filename();
$r->content_type('text/xml');
# Get the filename, extract some stats
my $file = $r->filename();
# $r->log_error("stat()ing $file");
my $filesize = (stat($file))[7];
my $mod = (stat(_))[9];
# Use the filename to retrive the path, and separate out the filename
my $path;
($path, $file) = $file =~ /(.*)\/(.*)/; # Extract the path/file info
my $uri = URI->new($r->uri());
$uri =~ s/^\///; # Trim the leading '/'
$uri = join("\n",
map { "<component><e>$_</e><u>" . uri_unescape($_) . "</u></component>" } split(/\//, $uri));
stylesheets/extractimageinfo.xps view on Meta::CPAN
if(! -d $cache_path) {
# $r->log_error("Need to make $cache_path");
mkpath($cache_path);
}
$metafile = "$cache_path/imageinfo.rdf";
# $r->log_error("metafile: $metafile");
# my $f_meta = -f $metafile;
# my $z_meta = -z $metafile;
# my $s_meta = (stat($metafile))[9];
# $r->log_error("f: $f_meta, z: $z_meta, mod: $imagemodtime, s: $s_meta");
if(! -f $metafile || -z $metafile
|| ($imagemodtime > (stat($metafile))[9])) {
# $r->log_error("Generating $metafile");
my $info = {};
$info->{imageinfo} = image_info("$path/$filename");
if(! $info->{error}) {
# Work out the width/height ratio, and calculate
# what the generated thumbnail dimensions will be
my($w, $h) = ($info->{imageinfo}{width},
$info->{imageinfo}{height});
( run in 0.988 second using v1.01-cache-2.11-cpan-49f99fa48dc )