PDA

View Full Version : aiuto PERL resize immagini (thumbs)



Mez
19th August 2007, 16:34
Allora, ho un grosso problema non riesco a capire come funziona questa benedetta gallery..

http://eresia-tnt.it/test/ (questo è il mio sito dove ho uplodato la gallery)

http://mig.sourceforge.net/gallery/index.php?currDir=. (questo è la gallery esempio del sito, cioè come la voglio io...)

come faccio a creare delle thumbs con lo script PERL? Devo modificare tramite li i parametri?
lo script è questo:


my $myself = File::Basename::basename($0); # Program name
my $mydir = File::Basename::dirname($0); # Directory $myself lives in
my $myRoot = cwd; # Directory I was started in

# Add this to the exec path - easier to find jhead than with relative paths.
# This will not modify the path outside of mkGallery.pl.
$ENV{'PATH'} .= ":$myRoot/$mydir";

my $exifProg = 'jhead'; # Name of jhead program
my $exifArgs = ''; # Pass no args to jhead
my $exifFile = 'exif.inf'; # File to store exif data in

# Defaults for boolean command-line flags
my $allFlag = 0; # -a: Process all images
my $exifFlag = 0; # -e: Process EXIF data
my $overwriteFlag = 0; # -w: Overwrite files instead of append
my $thumbFlag = 0; # -t: Create thumbnails
my $commentsFlag = 0; # -c: Create comments
my $interactFlag = 0; # -i: Interactive mode
my $recurseFlag = 0; # -r: Recursion mode
my $newOnlyFlag = 0; # -n: Process only new items
my $thumbDirFlag = 0; # -d: Use thumbnail subdirectories
my $largeDirFlag = 0; # -l: Use large subdirectories
my $keepProfilesFlag = 0; # -K: Keep profiles intact

# Defaults for command-line flags which take arguments
my $defaultSize = 100; # -s: Thumbnail size
my $defaultQuality = 50; # -q: Thumbnail quality
my $defaultMarker = ''; # -m: Thumbnail label
my $markerType = ''; # -M: Thumbnail label position
my $defaultThumbDir = 'thumbs'; # -D: Name of thumbnail subdirectory
my $defaultThumbExt = ''; # -E: File extension for thumbnails
my $defaultLargeDir = 'large'; # -L: Name of large subdirectory

# Mode to use for thumbnail subdirectories
my $thumbDirMode = 0755;


e ho pure un config.php ma questo mi pare di averlo gia settato ok, ma non capisco come funziona sta gallery:


//
// $useThumbSubdir
// Boolean to turn thumbnail subdirectories on or off.
// When this is set to TRUE, $markerType and $markerLabel are ignored.
//
// Defaults to TRUE.
//
// Example:
// $useThumbSubdir = TRUE;
//

$useThumbSubdir = TRUE;


//
// $thumbSubdir
// What subdirectory to use for thumbnails. This is ignored if
// $useThumbSubdir is set to FALSE.
//
// Defaults to "thumbs".
//
// Example:
// $thumbSubdir = "thumbs";
//

$thumbSubdir = FALSE;


//
// $randomFolderThumbs
// If TRUE, instead of the generic folder icon, a represenative
// thumbnail from the folder is shown. If Mig is unable to find a
// thumbnail to use, it will use the generic folder icon instead.
// Unless there are folders whose subfolders and their subfolders
// and so on have no thumbnails, the generic folder icon should
// never be used.
//
// Defaults to FALSE.
//
// Example:
// $randomFolderThumbs = FALSE;
//

$randomFolderThumbs = FALSE;


//
// $useRealRandThumbs
// If TRUE, a real random selection is done. It used to be that
// Mig would just look for the first thumbnail it could find and
// use that. A lot of people, including the author, thought that
// sucked, so $useRealRandThumbs was introduced which will find
// all available thumbnails and pick one randomly each time the
// script is called.
//
// This obviously results in more I/O and on large galleries could
// cause a problem with execution time. So I didn't "fix the bug"
// entirely, I made it an optional behavior. By default, real
// random behavior is used, but it can be turned off by setting this
// to FALSE.
//
// Generally, you want this to be TRUE unless you have trouble with
// it (most likely to happen if you have a slow server, a busy server,
// slow disks, or very large galleries).
//
// And of course this option is ignored if $randomFolderThumbs is
// set to FALSE.
//
// Defaults to TRUE.
//
// Example:
// $useRealRandThumbs = TRUE;
//

$useRealRandThumbs = TRUE;


//
// $useLargeImages
// Boolean to turn large image support on or off.
//
// Only turn this feature on if you intend to have three sizes of
// image - the thumbnail, the regular size version, and a full-size
// "large" version, such as the original file from the camera. Most
// users will want to leave this turned off.
//
// If set to TRUE, Mig will look for a "large" version of the image
// in $largeSubdir. If one is found, a link will be generated
// pointing to the large image.
//
// If $largeLinkFromMedium is TRUE, clicking on the medium image
// will also take the user to the large image. If you don't want
// a link printed, but just want to have people click on the medium
// image only, remove the %%largeLink%% tag from your image.html
// or mig_image.php template file.
//
// To use this feature, make sure the following tags are defined in
// your image.html or mig_image.php template:
//
// %%largeLink%% [optional, see above]
// %%largeHrefStart%%
// %%largeHrefEnd%%
// %%largeLinkBorder%%
//
// Also, copy large.html (or for PHP-Nuke etc, use mig_large.php)
// to your templates folder.
//
// Defaults to FALSE.
//
// Example:
// $useLargeImages = FALSE;
//

$useLargeImages = FALSE;


//
// $largeSubdir
// Name of subdirectory to use for "large" images. This option is
// ignored if $useLargeImages is FALSE.
//
// Defaults to "large".
//
// Example:
// $largeSubdir = "large";
//

$largeSubdir = "large";


//
// $largeLinkFromMedium
// If TRUE, when viewing a normal image, clicking the image will
// take you to the large version of the image (if present).
//
// If FALSE, clicking on the normal image will do nothing, regardless
// of the presence or absence a large version.
//
// In either case, if the template tag %%largeLink%% is used, a link
// to the image will be printed along with the other navigational
// links on the page.
//
// Defaults to TRUE.
//
// Example:
// $largeLinkFromMedium = TRUE;
//

$largeLinkFromMedium = TRUE;


//
// $largeLinkUseBorders
// When $largeLinkFromMedium is TRUE, this setting determines whether
// to show the link border around a medium image or not. If TRUE,
// the border is shown, if FALSE it is not shown.
//
// Defaults to FALSE.
//
// Example:
// $largeLinkUseBorders = FALSE;
//

$largeLinkUseBorders = FALSE;


//
// $folderNameLength
// If $randomFolderThumbs is TRUE, folder names will be truncated
// if they are longer than $folderNameLength characters. This is
// done to keep the tables formatted nicely. This option is ignored
// if $randomFolderThumbs is FALSE.
//
// Defaults to 15.
//
// Example:
// $folderNameLength = 15;
//

$folderNameLength = 15;


//
// $markerType
// Should I use a prefix or a suffix for thumbnails? This deals with
// the old way of doing thumbnail naming (i.e. img_4900_th.jpg
// instead of thumbs/img_4900.jpg).
//
// Valid values are 'prefix' and 'suffix'. Ignored if $useThumbSubdir
// is TRUE.
//
// If set to 'suffix', thumbnail will be named as in img_4900_th.jpg.
// If set to 'prefix', it will be named as in th_img_4900.jpg.
//
// This option is over-ridden by $useThumbSubdir. Using thumbnail
// subdirectories is recommended, so avoid this option (along with
// $markerLabel) if possible.
//
// Defaults to "suffix".
//
// Example:
// $markerType = "suffix";
//

$markerType = "suffix";

Mez
19th August 2007, 17:40
np, risolti, c'è un megabug nello script