Apache-Album

 view release on metacpan or  search on metacpan

Album.pm  view on Meta::CPAN

      }
      else {
	my $new_dir = "$album_dir$local_path_info$directory";
	$new_dir =~ s!/{2,},!/!g;
	$r->server->warn("Creating New Album: $new_dir");
	mkdir($new_dir, 0755);
      }
    }
    else {
      unless ($params{'New Album'}) {
	if (my $handle = $r->upload('filename')) {
	  my $filename = $handle->filename;
	  my ($type,$ext) = split(/\//,$handle->info("Content-type"));

	  if ($type eq 'image') {
	    # on NT $filename has \'s which we don't want!
	    $filename =~ s,.*\\,,;

	    $r->server->warn("Uploading: $filename");
	    my $local_path_info = $r->path_info;
	    my $fh = $handle->fh;

Album.pm  view on Meta::CPAN

		print OUT;
	      }
	      
	      close OUT;
	    }
	    else {
	      $r->log_error("Problem opening $album_dir$local_path_info$filename for write: $!");
	    }
	  }
	  else {
	    $r->log_error("Will not allow upload of: $filename $type/$ext");
	  }
	}
      }
    }
  }

  my $path_info = $r->path_info;
  $path_info =~ s!^/+!!;
  $path_info =~ s!/+$!!;

Album.pm  view on Meta::CPAN

	  : ($pixels_so_far > $settings{'DefaultBrowserWidth'})) {
	$r->print(qq!</TR><TR>!);
	$pixels_so_far = $settings{'ThumbNailWidth'};
	$columns_so_far = 0;
      }
    }
  }

  $r->print("</TR></TABLE></CENTER>\n");
  if ($settings{'EditMode'}) {
    $r->print(&file_upload());
  }
  $r->print("<hr>\n$settings{'Footer'}\n<hr>") if $settings{'Footer'};
  $r->print(<<EOF);
</BODY>
</HTML>
EOF

    return Apache2::Const::OK;
}

Album.pm  view on Meta::CPAN

  foreach (@dirs) {
    $r->print("\n<dl>\n");
    &list_dirs($r, $album_dir, $_, "", $settings );
    $r->print("\n</dl>\n");
  }

  if ($settings->{'EditMode'}) {
    $r->print(qq!<FORM METHOD="POST">New Album:<INPUT TYPE="text" NAME="AlbumName"><INPUT TYPE="submit" NAME="New Album" VALUE="New Album"></FORM>!);

    unless (@dirs) {
      $r->print(&file_upload());
    }
  }


  $r->print(<<EOF);
<HR>
<address>Apache::Album</address>
</BODY>
</HTML>
EOF

Album.pm  view on Meta::CPAN

  
  if (@dirs) {
    $r->print("\t<dd><dl>\n");
    foreach (@dirs) {
      &list_dirs($r, "$album_dir/$directory", $_, "$old_directory$directory/", $settings);
    }
    $r->print("\t</dl></dd>\n");
  }
}

# file_upload is just the html for the file upload
# it's in a sub since it will be called from multiple 
# places
sub file_upload {

  my $ret = <<EOF
<FORM METHOD="POST" ENCTYPE="multipart/form-data">
  <INPUT TYPE="submit" NAME="Upload" VALUE="Upload">
  <INPUT TYPE="file" NAME="filename" SIZE=50 MAXLENGTH=200>
</FORM>
EOF
  ;

  return $ret;

Album.pm  view on Meta::CPAN

show.

=item Footer

This text/html will placed at the bottom of the page after all the
thumbnails, but before the end of the page.  Useful for links back to
a home page, mailto: tag, etc.

=item EditMode

Allows the user to create new albums and upload pictures.  Obviously
there are security implications here, so if EditMode is turned on that
location should probably have some kind of security.  Albums can share
the same AlbumDir, so you can have something like:

/albums      - ReadOnly version, no security
/albums_edit - Allow new album creation and picture uploads, 
               require authentication

both using the same AlbumDir.

=item AllowFinalResize

If this is set to true, the user will have 3 additional options when
viewing the full sized picture.  The thumbnail can still be selected
to view the full picture, or Sm (Small), Med (Medium), or Lg(Large)
can be selected to bring the picture down to fit better in a 640x480,

Changes  view on Meta::CPAN

	  turned on
	- Added NumberOfColumns setting if someone wants to specify that
	  instead of the approx browser width
0.92  Wed Dec 01 23:16:00 1999
        - Added Sm Med Lg tags if AllowFinalResize is set, this creates smaller
          versions of the pictures, for people with small screens and/or small
          bandwidth
        - Added ReverseDirs/ReversePics which if set reverses the sort order
          of directories/pictures
        - Added EditMode which if set allows the end user to create new albums
          and upload pictures
0.01  Mon Sep 14 13:19:21 1998
	- original version; created by h2xs 1.18

README  view on Meta::CPAN

      BORDER attributes. Note that the name of the
      `InnerTablesBorder' has an 's' in it, as it modifes all the
      inner tables.

    Footer
      This text/html will placed at the bottom of the page after all
      the thumbnails, but before the end of the page. Useful for
      links back to a home page, mailto: tag, etc.

    EditMode
      Allows the user to create new albums and upload pictures.
      Obviously there are security implications here, so if EditMode
      is turned on that location should probably have some kind of
      security. Albums can share the same AlbumDir, so you can have
      something like:

      /albums - ReadOnly version, no security /albums_edit - Allow
      new album creation and picture uploads, require authentication

      both using the same AlbumDir.

    AllowFinalResize
      If this is set to true, the user will have 3 additional
      options when viewing the full sized picture. The thumbnail can
      still be selected to view the full picture, or Sm (Small), Med
      (Medium), or Lg(Large) can be selected to bring the picture
      down to fit better in a 640x480, 800x600, or 1024x758 screen.



( run in 3.593 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )