|Last modified: 14-11-2012|
Mig is a neat, no thrill, PHP script to build a photo gallery. As of oct 2003, it doesn't support on-the-fly thumbnailing or through-the-web uploads, but it doesn't require MySQL or any extra components, and can be set up in a couple of minutes. It can also be added to portals such as PHPNuke, PostNuke, PHPWebSite, PHPWebThings, or Xoops.
Each folder can have its own templates/ . See the FolderTemplate section of the mig_cf document for more information.
Tags available in any template:
Tags available in folder.html:
Tags available in image.html:
Included files must be located in the templates directory. As of version 1.2.5 it is possible to include PHP files as well as other types of files. The one difference is that for PHP files the filename must have an extension of either ".php" or ".php3".
If you are using PHP-Nuke, PostNuke or phpWebThings, these three files will not exist. This is called "Nuke" mode. In their place you'll find mig_folder.php and mig_image.php which are the same basically as folder.html and image.html respectively. In Nuke mode the CSS file is not used (Nuke systems have their own CSS already).
To display a text common to a gallery, use the Bulletin tag:
If you want a comment to be displayed either below the picture (when displayed in full size) or as the ALT or TITLE attribute (when shown as a thumbnail), add a file named mig.cf, with the following format:
(If you want to use shorter comments for thumbnail hover-overs and leave your longer comments only on the image page itself, see the mig_cf document and read about <Short> tags).
Certain HTML elements don't mix well with ALT and TITLE, and should be avoided, notably things like <A HREF>. You can turn ALT/TITLE tags off if you wish, by setting $suppressAltTags to TRUE in config.php.
Sometimes you want a long comment on the image itself, but a shorter one used in the ALT and TITLE tags on the thumbnail page (for hovering over links). You can use the <Short> tag in mig.cf files for that. This element works just like <Comment> except that it is used only in the hover-over tags on thumbnail pages.
If there is a <Comment> block but no <Short> block for an image, the <Comment> block will be used for the hover-over.
FolderIcon folder_name icon_file.gif
If you are using $randomFolderThumbs, note that FolderIcon overrides that setting. If you want to use a specific thumbnail for a given directory as its folder icon, you instead want to look at the UseThumb directive.
UseThumb folder_name image_name
Useful to hide files or folders.
EXIF data generally contains information such as shutter speed, aperture, ISO rating, the original shooting date and time, and sometimes comments.
Mig can read some, but not all, of this data. Future versions of Mig may understand more of the data than it currently does.
By default Mig only shows embedded comments. To show more, adjust the format string $exifFormatString found in config.php. There are examples in that file that explain how the formatting works.
Note that most graphic editors destroy EXIF blocks! They don't know how to write them so when they save images, they are simply not written back into the file.
A.k.a. "jump tags". Add a line to config.php that adds to the jump map.
$jumpMap['house'] = 'currDir=./Our%20House/Before%20We%20Redecorated';
This works with Apache web servers. I don't know if it works with anything else. If you're running something other than Apache, let me know how you fare with this feature.
Generate a hashed password:
$pass = 'somepassword';
$salt = 'Ai';
print crypt($pass, $salt);
The salt is any two-character combination - it is used to seed the random generation process, so to speak. Any two characters are good enough (but ":" (colon) can't be used in a salt string).
It's equally easy in Perl: perl -e 'print crypt("password","xy"),"\n";' Where password should be the password to encrypt, and xy is the two-character salt (any two characters beside a colon (":") will do).
$protect['./Pictures_of_me']['joe'] = 'IBDXWbkBirMfU';
To protect the main folder (root), either use .htaccess, or use Mig's password scheme (less securely):
$protect['.']['kate'] = 'BSkfNxImwPHeQ';
Items can be sorted in a custom order if desired (rather than relying on the default alphabetical order). To do this define a <sort> block in mig.cf. See the mig_cf document for details.
It's also possible to use multiple languages with Mig, although you must pick one to be the default language - that is the one you define in config.php in the $mig_language variable. To change the language, simply add the parameter mig_dl=LANG to a URL as a parameter. For example, take this URL:
Assuming the default is something else, you can tell Mig to display it in Spanish by doing this:
You can add links to your template files which switch languages on the fly using the template keyword newLang like this:
Pop-up windows can be used (see the $imagePopup option in config.php).
Sometimes a gallery gets so large, fitting all the thumbnails on one page becomes a problem (think of a gallery with 500 images). To resolve this, Mig paginates large galleries. By default, any gallery with more than 20 images will go into a paged mode (4 images across, in 5 rows).
This can be controlled using two options in config.php: $maxThumbColumns and $maxThumbRows. Their names are self-explanatory. Set $maxThumbColumns to the maximum number of columns desired (how many thumbnails across from left to right in one row). Set $maxThumbRows to the maximum number of rows per page/screen. The defaults are 4 columns and 5 rows (for 20 images per page).
Instead of using the generic folder icon for folder views, Mig can use a randomly selected thumbnail from the folder as the icon. To turn this behavior on, set $randomFolderThumbs to TRUE in config.php. (See also $folderNameLength and $useRealRandThumbs.)
To use a specific icon as the folder icon, check out the UseThumb option in mig.cf files. See the mig_cf document for more information.
This is a Perl utility provided by Mig to build thumbnails. It requires ImageMagick to run.
my $globalConfig = $mydir . '/../config.php'; # Global config file
$cmd = "convert -geometry $SIZE -quality $quality";
d:\temp\stuff>mkgallery.pl -a -t ERROR: marker type "" is invalid. Only "prefix" and "suffix" are valid. This could be specified as an argument for -M, or can be specifed in your config.php file (see $markerType)
If you'd rather use a DOS batch file instead of mkgallery.pl..
To make things more visually appealing, if a folder name contains underscores, eg. my_folder/, Mig will display it with spaces, ie. "my folder".