Skip Menu |
 

This queue is for tickets about the Apache-Gallery CPAN distribution.

Report information
The Basics
Id: 2748
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Apache-Gallery

People
Owner: Nobody in particular
Requestors: cpan [...] aaronland.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.6
Fixed in: (no value)

Attachments


Subject: Building with 5.005 and not scaling small images
Download (untitled) / with headers
text/plain 747b
Hi, I've attached a diff file that fixes two problems I found in Apache::Gallery. The first fix simply add parens when calling stat($file)->$sortby(); If there are other reasons the handler won't work under 5.005 I haven't found them yet :-) The second fix modified the scale_image to check to see if the scale dimensions are larger than the actual source file. If they are, the source file is simply copied to the cache directory and the function returns true. This is a bit of a kludge, but it was a quick fix without having to add a bunch of if/else code all over the place and it keeps small pictures from being pixelated. The dimensions string passed to the templates was also updated accordingly. Cheers (and thanks for the package),
Download apache-gallery.diff
text/x-diff 1.6k
--- /usr/local/lib/perl5/site_perl/5.8.0/Apache/Gallery.pm.dist Mon Apr 21 07:26:51 2003 +++ /usr/local/lib/perl5/site_perl/5.8.0/Apache/Gallery.pm Thu Jun 5 15:38:08 2003 @@ -118,7 +118,7 @@ my $sortby = $r->dir_config('GallerySortBy'); if ($sortby && $sortby =~ m/^(size|atime|mtime|ctime)$/) { - @files = map(/^\d+ (.*)/, sort map(stat("$filename/$_")->$sortby." $_", @files)); + @files = map(/^\d+ (.*)/, sort map(stat("$filename/$_")->$sortby()." $_", @files)); } else { @files = sort @files; } @@ -333,9 +333,12 @@ nopictureinfo => 'nopictureinfo.tpl' ); + my $resolution = (($image_width > $orig_width) && ($height > $orig_height)) ? + "$orig_width x $orig_height" : "$image_width x $height"; + $tpl->assign(TITLE => "Viewing ".$r->uri()." at $image_width x $height"); $tpl->assign(META => " "); - $tpl->assign(RESOLUTION => "$image_width x $height"); + $tpl->assign(RESOLUTION => $resolution); $tpl->assign(MENU => generate_menu($r)); $tpl->assign(SRC => uri_escape(".cache/$cached", $escape_rule)); $tpl->assign(URI => $r->uri()); @@ -576,6 +579,17 @@ pop(@cachedir) unless (-d join("/", @cachedir)); my $cache = join("/", @cachedir); + + if (($width > $orig_width) && ($height > $orig_height)) { + require File::Copy; + require File::Basename; + + my $fname = File::Basename::basename($fullpath); + my $cachefile = join("/",$cache,$fname); + File::Copy::copy($fullpath,$cachefile); + + return $fname; + } my ($thumbnailwidth, $thumbnailheight) = split(/x/, ($r->dir_config('GalleryThumbnailSize') ? $r->dir_config('GalleryThumbnailSize') : "100x75"));
Download (untitled) / with headers
text/plain 489b
[guest - Thu Jun 5 15:50:40 2003]: Show quoted text
> The first fix simply add parens when calling stat($file)->$sortby(); > If there are other reasons the handler won't work under 5.005 I > haven't found them yet :-) > > The second fix modified the scale_image to check to see if the scale > dimensions are larger than the actual source file. If they are, the > source file is simply copied to the cache directory and the > function returns true.
Thanks - it has been applied. Michael


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.