Gallery3:Modules:proofsheet - Gallery Codex
Personal tools

Gallery3:Modules:proofsheet

From Gallery Codex

ProofSheet Module

ProofSheet will display links to generate a PDF proof sheet (a.k.a contact sheet or index sheet) of the current album or tag. One link is for A4 size; the other is for LTR size. Examples of the resulting PDFs are given in screenshots below.

Note that A4 is the international paper standard (210mm x 297mm) and LTR is the American paper standard (8.5" x 11").

Description

ProofSheet is a module for Gallery 3 which will allow you to add two links to generate PDF proof sheets in A4 or LTR size paper. This module will only be displayed when the visitor has sufficient privileges to access the full sized version of the photos of the current album or tag.

The PDF is generated on-the-fly. There are no files, even temporary, stored on the server. The PDF is generated using FPDF, a php library for building PDFs, and does not require GhostScript. This makes it easier to implement for shared hosting servers (e.g. GoDaddy).

Features

  • Allow visitor to download a PDF proof files of an album or tag.
  • Automatically detects if the current visitor has sufficient privileges to download the originals photos of the album and hides itself if that is not the case.

Installation

This module may be downloaded from the Gallery forums here. A copy of FPDF, the php library used to generate the PDF file, is included (for more information, see FPDF's site here here).

  • Download and extract proofsheet, then put the proofsheet folder into your Gallery modules folder.
  • Log into your Gallery as an administrator and activate the module in the Admin -> Modules menu.

Tweaks and modifications

Disabling either A4 or LTR link

If you only want one of the two links, edit /proofsheet/helpers/proofsheet_event.php. The comments in the code will direct you to which pieces you need to disable, either by deleting or commenting out.

Changing the icons

You can change the icons by replacing the existing ones in the /proofsheet/images/ directory. This might be useful, for example, if you only have one of the two links displayed and don't need it to say A4 or LTR. In fact, I've already included two extra files in the directly, called unused-a4-notext.png and unused-ltr-notext.png, that could be used for this purpose.

Changing the formatting of the PDF proof sheet

Currently, the formatting is set for the thumbnail to fit into a 36mm x 36mm square, emulating the size of standard 135 film (or a full-frame DSLR), on portrait-sized paper. However, this can be changed any way you desire.

If you want two tweak the formatting of the PDF, edit /proofsheet/controllers/proofsheet.php. All of the useful parameters to determine formatting are in one place, and all are inside the array cfg. A search for "$cfg" or "tweak the formatting" will find the spot in the code where this is. Note that this set is defined for two different cases, namely A4 and LTR.

Some examples:

  • To change the 36x36 square to a 36x24 rectangle, set imageSizeH=24. Then, you can increase the number of rows by changing imageNumH.
  • To make the pages landscape instead of portrait, invert the values for pageH and pageW. Then, you'll also need to change imageNumW and imageNumH to fit.
  • To change the "Page " text in the footer, change footerTextPage. This could be useful when translating languages. Or, set it to to make it truly language-independent.

Changelog

  • 2012/10/04, version 7

Fixed bug related to the URL for proofsheets of tags (as opposed to albums)

  • 2012/06/15, version 6

Fixed bug that could cause a crash when trying to use GD or GIF files (a typo from version 5)

  • 2012/04/05, version 5

Added ability to include GIF thumbnails if GD is installed (FPDF uses GD).
Changed behavior of unhandled file types - now provides missing image icon instead of throwing an exception.

  • 2012/03/30, version 4

Major rewrite. Output is similar, but everything "under the hood" is much cleaner and (I hope) more easily understood and tweakable by other users.
Header link is now an icon.
Fixed encoding problems with diacritic marks and special characters.
Now includes FPDF as a library instead of requiring a separate installtion.

  • 2012/03/28, version 3

Made sizing configuration more flexible
Prettified code so it's easier to understand and tweak as desired
Added header link
First version properly documented and linked to Gallery wiki

  • 2012/03/27, version 2

Determines jpg/png type by file header, not extension, which makes it robust against misnamed extensions
(N.B.: there's a bug in some movie modules that copy missing_movie.png as a jpg thumbnail!)
Made caption size limits to prevent overrun

  • 2012/03/27, version 1

Initial release