]> git.donarmstrong.com Git - deb_pkgs/libapache-gallery-perl.git/commitdiff
Add support for thumbonly to the Debian package
authorDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 18:17:37 +0000 (11:17 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 2 Nov 2017 18:17:37 +0000 (11:17 -0700)
debian/changelog
lib/Apache/Gallery.pm

index 03ca9a7321adb50f93a25510b961063ee78e0451..2a6e7ca9eba22c9cdf12698b454bf0ee6a12c99c 100644 (file)
@@ -3,6 +3,7 @@ libapache-gallery-perl (1.0.2-5) unstable; urgency=medium
   * Acknowledge NMU changes
   * Update standards version, no changes
   * Fix VCS urls
+  * Add support for ?thumbonly to the debian package
 
  --
 
index b4575bee7fed4d7d59f4fd1a8f4c744818fb339c..88a03b4b71d1576ea12c6d94ee250879777711f2 100644 (file)
@@ -540,6 +540,20 @@ sub handler {
                                return $::MP2 ? Apache2::Const::FORBIDDEN() : Apache::Constants::FORBIDDEN();
                        }
                }
+        if (defined $ENV{QUERY_STRING} && $ENV{QUERY_STRING} eq 'thumbonly' &&
+            $r->dir_config('GalleryAllowThumbonly') &&
+            -f $filename) {
+
+            my ($width, $height, $type) = imgsize($filename);
+            my @filetypes = qw(JPG TIF PNG PPM GIF);
+            if (grep $type eq $_, @filetypes) {
+                my ($thumbnailwidth, $thumbnailheight) = get_thumbnailsize($r, $width, $height);
+                my $imageinfo = get_imageinfo($r, $filename, $type, $width, $height);
+                my $cached = get_scaled_picture_name($filename, $thumbnailwidth, $thumbnailheight);
+                $r->headers_out->set(Location => uri_escape(".cache/$cached", $escape_rule));
+                return $::MP2 ? Apache2::Const::REDIRECT() : Apache::Constants::REDIRECT();
+            }
+        }
        
                # Create cache dir if not existing
                my @tmp = split (/\//, $filename);
@@ -1759,6 +1773,14 @@ resizing or putting the CopyrightImage on it.
 
 Set to 1 or 0, default is 0
 
+=item B<GalleryAllowThumbOnly>
+
+If true, B<GalleryAllowThumbOnly> allows fooimg.jpg?thumbonly urls
+to output the thumbnail of the image. This is useful when including
+images in a blog (or similar).
+
+Defaults to '0' (false).
+
 =item B<GallerySlideshowIntervals>
 
 With this option you can configure which intervals can be selected for