Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for web-apps/fastcgi-gallery/_modules/gallery.pm between version 1.5 and 1.6

version 1.5, 2005/10/18 12:57:19 version 1.6, 2006/01/25 15:09:11
Line 10 
Line 10 
 # 2005-07-19 - created  # 2005-07-19 - created
 #  #
   
 # $Platon: web-apps/fastcgi-gallery/_modules/gallery.pm,v 1.4 2005/10/18 12:51:47 rajo Exp $  # $Platon: web-apps/fastcgi-gallery/_modules/gallery.pm,v 1.5 2005/10/18 12:57:19 rajo Exp $
   
 package gallery;  package gallery;
   
Line 77  sub error()
Line 77  sub error()
 sub handler { # {{{  sub handler { # {{{
         my ($self, $query, $cookie) = @_;          my ($self, $query, $cookie) = @_;
   
           $self->{__use_cache} = 1;
         my %tpl_vars;          my %tpl_vars;
   
         my $uri = $query->{gallery} || '/';          my $uri = $query->{gallery} || '/';
Line 116  sub handler { # {{{
Line 117  sub handler { # {{{
   
                 my ($mime_type, $encoding) = by_suffix($file);                  my ($mime_type, $encoding) = by_suffix($file);
                 return {                  return {
                           use_cache       => $self->{__use_cache},
                         content => {                          content => {
                                 mime_type       => $mime_type,                                  mime_type       => $mime_type,
                                 encoding        => $encoding,                                  encoding        => $encoding,
Line 138  sub handler { # {{{
Line 140  sub handler { # {{{
         if (-f $abs_filename && $abs_filename !~ m/$img_pattern/i) {          if (-f $abs_filename && $abs_filename !~ m/$img_pattern/i) {
                 if ($abs_filename =~ m/$doc_pattern/i) {                  if ($abs_filename =~ m/$doc_pattern/i) {
                         return {                          return {
                                   use_cache       => $self->{__use_cache},
                                 location        => "$top_location/$filename",                                  location        => "$top_location/$filename",
                         };                          };
                 }                  }
Line 234  sub handler { # {{{
Line 237  sub handler { # {{{
                         $tpl_vars{COMMENT} = '';                          $tpl_vars{COMMENT} = '';
                 }                  }
   
                   $tpl_vars{use_cache} = $self->{__use_cache};
   
                 return \%tpl_vars;                  return \%tpl_vars;
   
         } # }}} directory listing          } # }}} directory listing
Line 247  sub handler { # {{{
Line 252  sub handler { # {{{
   
                                 my ($mime_type, $encoding) = by_suffix($abs_filename);                                  my ($mime_type, $encoding) = by_suffix($abs_filename);
                                 return {                                  return {
                                           use_cache       => $self->{__use_cache},
                                         content => {                                          content => {
                                                 mime_type       => $mime_type,                                                  mime_type       => $mime_type,
                                                 encoding        => $encoding,                                                  encoding        => $encoding,
Line 313  sub handler { # {{{
Line 319  sub handler { # {{{
                 $tpl_vars{cur_image} = {                  $tpl_vars{cur_image} = {
                         name            => $picfilename,                          name            => $picfilename,
                         url                     => "$path$picfilename",                          url                     => "$path$picfilename",
                         src                     => ".cache$path$cached",                          src                     => get_cache_filename($self, $path, $cached),
                         meta            => '',                          meta            => '',
                         resolution      => $resolution,                          resolution      => $resolution,
                         width           => (($image_width > $orig_width) && ($height > $orig_height)) ? $orig_width             : $image_width,                          width           => (($image_width > $orig_width) && ($height > $orig_height)) ? $orig_width             : $image_width,
Line 365  sub handler { # {{{
Line 371  sub handler { # {{{
                                                 url             => "$path$prevpicture",                                                  url             => "$path$prevpicture",
                                                 width   => $thumbnailwidth,                                                  width   => $thumbnailwidth,
                                                 height  => $thumbnailheight,                                                  height  => $thumbnailheight,
                                                 src             => ".cache$path$cached",                                                  src             => get_cache_filename($self, $path, $cached),
                                         };                                          };
                                 }                                  }
                                 else {                                  else {
Line 383  sub handler { # {{{
Line 389  sub handler { # {{{
                                                 width   => $thumbnailwidth,                                                  width   => $thumbnailwidth,
                                                 height  => $thumbnailheight,                                                  height  => $thumbnailheight,
                                                 src             => ".cache$path$cached",                                                  src             => ".cache$path$cached",
                                                   src             => get_cache_filename($self, $path, $cached),
                                                 # Mozilla prefetch feature: http://www.mozilla.org/projects/netlib/Link_Prefetching_FAQ.html                                                  # Mozilla prefetch feature: http://www.mozilla.org/projects/netlib/Link_Prefetching_FAQ.html
                                                 prefetch        => ".cache$path" . get_scaled_picture_name($self, $path.$nextpicture, $type, $image_width, $height),                                                  prefetch        => get_cache_filename($self, $path, get_scaled_picture_name($self, $path.$nextpicture, $type, $image_width, $height)),
                                         };                                          };
                                 }                                  }
                                 else {                                  else {
Line 444  sub handler { # {{{
Line 451  sub handler { # {{{
                         };                          };
                 }                  }
   
                   $tpl_vars{use_cache} = $self->{__use_cache};
   
                 return \%tpl_vars;                  return \%tpl_vars;
   
         } # }}} image page          } # }}} image page
Line 471  sub cache_dir { # {{{
Line 480  sub cache_dir { # {{{
         }          }
 } # }}}  } # }}}
   
   sub get_cache_filename { # {{{
   
           my ($self, $path, $filename) = @_;
           my $rv;
   
           if ($self->config('GalleryDirectCacheAccess')) {
                   if (-f $self->config('GalleryCacheDir') . "$path$filename") {
                           $rv = {
                                   url     => $self->config('GalleryDirectCacheAccess') . "$path$filename",
                                   direct_cache    => 1,
                           };
                   }
                   else {
                           $rv = {
                                   url     => ".cache$path$filename",
                                   direct_cache    => 0,
                           };
                           $self->{__use_cache} &&= 0; # don't cache this request
                   }
           }
           else {
                   $rv = {
                           url     => ".cache$path$filename",
                           direct_cache    => 0,
                   };
           }
   
           return $rv;
   
   } # }}}
   
 sub get_scaled_picture_name { # {{{  sub get_scaled_picture_name { # {{{
   
         my ($self, $fullpath, $type, $width, $height) = @_;          my ($self, $fullpath, $type, $width, $height) = @_;
Line 552  sub get_fileinfo($$$;) { # {{{
Line 592  sub get_fileinfo($$$;) { # {{{
                 size    => stat($file)->size,                  size    => stat($file)->size,
                 type    => lc([$file =~ /$img_pattern/i]->[0]), # return matched file extension                  type    => lc([$file =~ /$img_pattern/i]->[0]), # return matched file extension
                 date    => ($imageinfo->{DateTimeOriginal} or strftime("%Y-%m-%d %X", localtime(stat($file)->mtime))),                  date    => ($imageinfo->{DateTimeOriginal} or strftime("%Y-%m-%d %X", localtime(stat($file)->mtime))),
                 src             => ".cache$self->{_filename}/$cached",                  src             => get_cache_filename($self, "$self->{_filename}/", $cached),
                 url             => "$self->{_filename}/$filename",                  url             => "$self->{_filename}/$filename",
                 height  => (grep($rotate == $_, (1, 3)) ? $thumbnailwidth  : $thumbnailheight),                  height  => (grep($rotate == $_, (1, 3)) ? $thumbnailwidth  : $thumbnailheight),
                 width   => (grep($rotate == $_, (1, 3)) ? $thumbnailheight : $thumbnailwidth),                  width   => (grep($rotate == $_, (1, 3)) ? $thumbnailheight : $thumbnailwidth),

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top