Initial commit of Thomas Rybak's original version

This commit is contained in:
Sebastien SAUVAGE 2013-03-23 17:35:44 +01:00
commit 373df6fb09
39 changed files with 8346 additions and 0 deletions

22
.gitattributes vendored Normal file
View file

@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
photos/

15
README.md Normal file
View file

@ -0,0 +1,15 @@
Minigal Nano SSE
================
MiniGal Nano is a very simple image gallery. It only requires php and GD (no database, no special libraries like PEAR or ImageMagick). MiniGal Nano does not have a web admin interface: You only have to upload your images in the photo folder.
This fork (Minigal Nano SSE) is based on Thomas Rybak's version which seems to have been abandonned in 2010: http://www.minigal.dk/minigal-nano.html
This fork holds some improvements, like thumbnail cache and folder/image description.
------------------------------------------------------------------------------
MiniGal Nano SSE by Sébastien SAUVAGE is licensed under a Creative Commons Attribution-Share Alike.
https://creativecommons.org/licenses/by-sa/2.5/
------------------------------------------------------------------------------

43
config.php Normal file
View file

@ -0,0 +1,43 @@
<?php
/*
MINIGAL NANO
- A PHP/HTML/CSS based image gallery script
This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
MiniGal Nano is created by Thomas Rybak
Copyright 2010 by Thomas Rybak
Support: www.minigal.dk
Community: www.minigal.dk/forum
Please enjoy this free script!
*/
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
$thumbs_pr_page = "28"; //Number of thumbnails on a single page
$gallery_width = "900px"; //Gallery width. Eg: "500px" or "70%"
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
$templatefile = "mano"; //Template filename (must be placed in 'templates' folder)
$title = "MiniGal Nano Testsite"; // Text to be displayed in browser titlebar
$author = "Rybber";
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
$sorting_folders = "name"; // Sort folders by: [name][date]
$sorting_files = "name"; // Sort files by: [name][date][size]
$sortdir_folders = "ASC"; // Sort direction of folders: [ASC][DESC]
$sortdir_files = "ASC"; // Sort direction of files: [ASC][DESC]
//LANGUAGE STRINGS
$label_home = "Home"; //Name of home link in breadcrumb navigation
$label_new = "New"; //Text to display for new images. Use with $display_new variable
$label_page = "Page"; //Text used for page navigation
$label_all = "All"; //Text used for link to display all images in one page
$label_noimages = "No images"; //Empty folder text
$label_loading = "Loading..."; //Thumbnail loading text
//ADVANCED SETTINGS
$thumb_size = 120; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
$label_max_length = 30; //Maximum chars of a folder name that will be displayed on the folder thumbnail
$display_exif = 1;
?>

43
config_default.php Normal file
View file

@ -0,0 +1,43 @@
<?php
/*
MINIGAL NANO
- A PHP/HTML/CSS based image gallery script
This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
MiniGal Nano is created by Thomas Rybak
Copyright 2010 by Thomas Rybak
Support: www.minigal.dk
Community: www.minigal.dk/forum
Please enjoy this free script!
*/
// EDIT SETTINGS BELOW TO CUSTOMIZE YOUR GALLERY
$thumbs_pr_page = "18"; //Number of thumbnails on a single page
$gallery_width = "900px"; //Gallery width. Eg: "500px" or "70%"
$backgroundcolor = "white"; //This provides a quick way to change your gallerys background to suit your website. Use either main colors like "black", "white", "yellow" etc. Or HEX colors, eg. "#AAAAAA"
$templatefile = "mano"; //Template filename (must be placed in 'templates' folder)
$title = "My Gallery"; // Text to be displayed in browser titlebar
$author = "Me :)";
$folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey
$sorting_folders = "name"; // Sort folders by: [name][date]
$sorting_files = "name"; // Sort files by: [name][date][size]
$sortdir_folders = "ASC"; // Sort direction of folders: [ASC][DESC]
$sortdir_files = "ASC"; // Sort direction of files: [ASC][DESC]
//LANGUAGE STRINGS
$label_home = "Home"; //Name of home link in breadcrumb navigation
$label_new = "New"; //Text to display for new images. Use with $display_new variable
$label_page = "Page"; //Text used for page navigation
$label_all = "All"; //Text used for link to display all images in one page
$label_noimages = "No images"; //Empty folder text
$label_loading = "Loading..."; //Thumbnail loading text
//ADVANCED SETTINGS
$thumb_size = 120; //Thumbnail height/width (square thumbs). Changing this will most likely require manual altering of the template file to make it look properly!
$label_max_length = 30; //Maximum chars of a folder name that will be displayed on the folder thumbnail
$display_exif = 0;
?>

92
createthumb.php Normal file
View file

@ -0,0 +1,92 @@
<?php
/*
MINIGAL NANO
- A PHP/HTML/CSS based image gallery script
This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
MiniGal Nano is created by Thomas Rybak
Copyright 2010 by Thomas Rybak
Support: www.minigal.dk
Community: www.minigal.dk/forum
Please enjoy this free script!
USAGE EXAMPLE:
File: createthumb.php
Example: <img src="createthumb.php?filename=photo.jpg&amp;width=100&amp;height=100">
*/
// error_reporting(E_ALL);
if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) header('Content-type: image/jpeg');
if (preg_match("/.gif$/i", $_GET['filename'])) header('Content-type: image/gif');
if (preg_match("/.png$/i", $_GET['filename'])) header('Content-type: image/png');
// Display error image if file isn't found
if (!is_file($_GET['filename'])) {
header('Content-type: image/jpeg');
$errorimage = ImageCreateFromJPEG('images/questionmark.jpg');
ImageJPEG($errorimage,null,90);
}
// Display error image if file exists, but can't be opened
if (substr(decoct(fileperms($_GET['filename'])), -1, strlen(fileperms($_GET['filename']))) < 4 OR substr(decoct(fileperms($_GET['filename'])), -3,1) < 4) {
header('Content-type: image/jpeg');
$errorimage = ImageCreateFromJPEG('images/cannotopen.jpg');
ImageJPEG($errorimage,null,90);
}
// Define variables
$target = "";
$xoord = 0;
$yoord = 0;
if ($_GET['size'] == "") $_GET['size'] = 120; //
$imgsize = GetImageSize($_GET['filename']);
$width = $imgsize[0];
$height = $imgsize[1];
if ($width > $height) { // If the width is greater than the height its a horizontal picture
$xoord = ceil(($width-$height)/2);
$width = $height; // Then we read a square frame that equals the width
} else {
$yoord = ceil(($height-$width)/2);
$height = $width;
}
// Rotate JPG pictures
if (preg_match("/.jpg$|.jpeg$/i", $_GET['filename'])) {
if (function_exists('exif_read_data') && function_exists('imagerotate')) {
$exif = exif_read_data($_GET['filename']);
$ort = $exif['IFD0']['Orientation'];
$degrees = 0;
switch($ort)
{
case 6: // 90 rotate right
$degrees = 270;
break;
case 8: // 90 rotate left
$degrees = 90;
break;
}
if ($degrees != 0) $target = imagerotate($target, $degrees, 0);
}
}
$target = ImageCreatetruecolor($_GET['size'],$_GET['size']);
if (preg_match("/.jpg$/i", $_GET['filename'])) $source = ImageCreateFromJPEG($_GET['filename']);
if (preg_match("/.gif$/i", $_GET['filename'])) $source = ImageCreateFromGIF($_GET['filename']);
if (preg_match("/.png$/i", $_GET['filename'])) $source = ImageCreateFromPNG($_GET['filename']);
imagecopyresampled($target,$source,0,0,$xoord,$yoord,$_GET['size'],$_GET['size'],$width,$height);
imagedestroy($source);
if (preg_match("/.jpg$/i", $_GET['filename'])) ImageJPEG($target,null,90);
if (preg_match("/.gif$/i", $_GET['filename'])) ImageGIF($target,null,90);
if (preg_match("/.png$/i", $_GET['filename'])) ImageJPEG($target,null,90); // Using ImageJPEG on purpose
imagedestroy($target);
?>

167
css/mediaboxAdvBlack21.css Normal file
View file

@ -0,0 +1,167 @@
/* mediaboxAdvanced Black theme */
/* version 2.1 - August 2010 */
/* for mediaboxAdvanced v.1.3.1 */
/* Overlay background styling */
#mbOverlay {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
/* Legacy fix for older browsers */
#mbOverlay.mbOverlayFF {
background: transparent url(../images/80.png) repeat;
}
#mbOverlay.mbOverlayIE {
position: absolute;
}
/* Overlay panel styling */
#mbCenter {
position: absolute;
z-index: 9999;
left: 50%;
overflow: hidden;
background-color: #000;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-khtml-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-moz-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=180, Color='#000000')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=180, Color='#000000');
}
#mbCenter.mbLoading {
background: #000 url(../images/loading2.gif) no-repeat center;
/* This style is applied only during animation. */
/* For example, the next lines turn off shadows */
/* improving browser performance on slow systems. */
/* To leave shadows on, just remove the following: */
-webkit-box-shadow: none;
-khtml-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
#mbImage {
position: relative;
left: 0;
top: 0;
/* Inline content styling */
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #fff;
text-align: left;
background-position: center center;
background-repeat: no-repeat;
padding: 10px;
}
/* Title, Caption and Button styling */
#mbBottom {
min-height: 20px;
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #999;
text-align: left;
padding: 0 10px 10px;
}
#mbTitle, #mbPrevLink, #mbNextLink, #mbCloseLink {
display: inline;
color: #fff;
font-weight: bold;
line-height: 20px;
font-size: 12px;
}
#mbNumber {
display: inline;
color: #999;
line-height: 14px;
font-size: 10px;
margin: auto 10px;
}
#mbCaption {
display: block;
color: #999;
line-height: 14px;
font-size: 10px;
}
#mbPrevLink, #mbNextLink, #mbCloseLink {
float: right;
outline: none;
margin: 0 0 0 10px;
font-weight: normal;
}
#mbPrevLink b, #mbNextLink b, #mbCloseLink b {
color: #eee;
font-weight: bold;
text-decoration: underline;
}
#mbPrevLink big, #mbNextLink big, #mbCloseLink big {
color: #eee;
font-size: 16px;
line-height: 14px;
font-weight: bold;
}
#mbBottom a, #mbBottom a:link, #mbBottom a:visited { /* Thanks to Danny Jung for feedback and corrections */
text-decoration: none;
color: #ddd;
}
#mbBottom a:hover, #mbBottom a:active {
text-decoration: underline;
color: #fff;
}
/* Error message styling */
#mbError {
position: relative;
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #fff;
text-align: center;
border: 10px solid #700;
padding: 10px 10px 10px;
margin: 20px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#mbError a, #mbError a:link, #mbError a:visited, #mbError a:hover, #mbError a:active {
color: #d00;
font-weight: bold;
text-decoration: underline;
}

167
css/mediaboxAdvWhite.css Normal file
View file

@ -0,0 +1,167 @@
/* mediaboxAdvanced Black theme */
/* version 2.1 - August 2010 */
/* for mediaboxAdvanced v.1.3.1 */
/* Overlay background styling */
#mbOverlay {
position: fixed;
z-index: 9998;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
/* Legacy fix for older browsers */
#mbOverlay.mbOverlayFF {
background: transparent url(../images/80.png) repeat;
}
#mbOverlay.mbOverlayIE {
position: absolute;
}
/* Overlay panel styling */
#mbCenter {
position: absolute;
z-index: 9999;
left: 50%;
overflow: hidden;
background-color: #fff;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-khtml-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
-moz-box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
box-shadow: 0px 5px 20px rgba(0,0,0,0.50);
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=180, Color='#000000')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=5, Direction=180, Color='#000000');
}
#mbCenter.mbLoading {
background: #fff url(../images/WhiteLoading.gif) no-repeat center;
/* This style is applied only during animation. */
/* For example, the next lines turn off shadows */
/* improving browser performance on slow systems. */
/* To leave shadows on, just remove the following: */
-webkit-box-shadow: none;
-khtml-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
#mbImage {
position: relative;
left: 0;
top: 0;
/* Inline content styling */
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #333;
text-align: left;
background-position: center center;
background-repeat: no-repeat;
padding: 10px;
}
/* Title, Caption and Button styling */
#mbBottom {
min-height: 20px;
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #000;
text-align: left;
padding: 0 10px 10px;
}
#mbTitle, #mbPrevLink, #mbNextLink, #mbCloseLink {
display: inline;
color: #000;
font-weight: bold;
line-height: 20px;
font-size: 12px;
}
#mbNumber {
display: inline;
color: #333;
line-height: 14px;
font-size: 10px;
margin: auto 10px;
}
#mbCaption {
display: block;
color: #000;
line-height: 14px;
font-size: 10px;
}
#mbPrevLink, #mbNextLink, #mbCloseLink {
float: right;
outline: none;
margin: 0 0 0 10px;
font-weight: normal;
}
#mbPrevLink b, #mbNextLink b, #mbCloseLink b {
color: #333;
font-weight: bold;
text-decoration: underline;
}
#mbPrevLink big, #mbNextLink big, #mbCloseLink big {
color: #333;
font-size: 16px;
line-height: 14px;
font-weight: bold;
}
#mbBottom a, #mbBottom a:link, #mbBottom a:visited { /* Thanks to Danny Jung for feedback and corrections */
text-decoration: none;
color: #ddd;
}
#mbBottom a:hover, #mbBottom a:active {
text-decoration: underline;
color: #000;
}
/* Error message styling */
#mbError {
position: relative;
font-family: Myriad, Verdana, Arial, Helvetica, sans-serif;
line-height: 20px;
font-size: 12px;
color: #fff;
text-align: center;
border: 10px solid #700;
padding: 10px 10px 10px;
margin: 20px;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#mbError a, #mbError a:link, #mbError a:visited, #mbError a:hover, #mbError a:active {
color: #d00;
font-weight: bold;
text-decoration: underline;
}

BIN
images/50.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 B

BIN
images/80.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

BIN
images/WhiteLoading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/cannotopen.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

BIN
images/filetype_DOCX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/filetype_GZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/filetype_PDF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/filetype_PPTX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/filetype_RAR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/filetype_TAR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/filetype_XLXS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/filetype_ZIP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/folder_black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
images/folder_blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
images/folder_green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
images/folder_grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
images/folder_purple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
images/folder_vista.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
images/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/loading2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/loading3.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/questionmark.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

409
index.php Normal file
View file

@ -0,0 +1,409 @@
<?php
/*
MINIGAL NANO
- A PHP/HTML/CSS based image gallery script
This script and included files are subject to licensing from Creative Commons (http://creativecommons.org/licenses/by-sa/2.5/)
You may use, edit and redistribute this script, as long as you pay tribute to the original author by NOT removing the linkback to www.minigal.dk ("Powered by MiniGal Nano x.x.x")
MiniGal Nano is created by Thomas Rybak
Copyright 2010 by Thomas Rybak
Support: www.minigal.dk
Community: www.minigal.dk/forum
Please enjoy this free script!
*/
// Do not edit below this section unless you know what you are doing!
//-----------------------
// Debug stuff
//-----------------------
error_reporting(E_ERROR);
// error_reporting(E_ALL);
// error_reporting(0);
/*
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
*/
$version = "0.3.5";
ini_set("memory_limit","256M");
require("config_default.php");
include("config.php");
//-----------------------
// DEFINE VARIABLES
//-----------------------
$page_navigation = "";
$breadcrumb_navigation = "";
$thumbnails = "";
$new = "";
$images = "";
$exif_data = "";
$messages = "";
//-----------------------
// PHP ENVIRONMENT CHECK
//-----------------------
if (!function_exists('exif_read_data') && $display_exif == 1) {
$display_exif = 0;
$messages = "Error: PHP EXIF is not available. Set &#36;display_exif = 0; in config.php to remove this message";
}
//-----------------------
// FUNCTIONS
//-----------------------
function is_directory($filepath) {
// $filepath must be the entire system path to the file
if (!@opendir($filepath)) return FALSE;
else {
return TRUE;
closedir($filepath);
}
}
function padstring($name, $length) {
global $label_max_length;
if (!isset($length)) $length = $label_max_length;
if (strlen($name) > $length) {
return substr($name,0,$length) . "...";
} else return $name;
}
function getfirstImage($dirname) {
$imageName = false;
$ext = array("jpg", "png", "jpeg", "gif", "JPG", "PNG", "GIF", "JPEG");
if($handle = opendir($dirname))
{
while(false !== ($file = readdir($handle)))
{
$lastdot = strrpos($file, '.');
$extension = substr($file, $lastdot + 1);
if ($file[0] != '.' && in_array($extension, $ext)) break;
}
$imageName = $file;
closedir($handle);
}
return($imageName);
}
function readEXIF($file) {
$exif_data = "";
$exif_idf0 = exif_read_data ($file,'IFD0' ,0 );
$emodel = $exif_idf0['Model'];
$efocal = $exif_idf0['FocalLength'];
list($x,$y) = split('/', $efocal);
$efocal = round($x/$y,0);
$exif_exif = exif_read_data ($file,'EXIF' ,0 );
$eexposuretime = $exif_exif['ExposureTime'];
$efnumber = $exif_exif['FNumber'];
list($x,$y) = split('/', $efnumber);
$efnumber = round($x/$y,0);
$eiso = $exif_exif['ISOSpeedRatings'];
$exif_date = exif_read_data ($file,'IFD0' ,0 );
$edate = $exif_date['DateTime'];
if (strlen($emodel) > 0 OR strlen($efocal) > 0 OR strlen($eexposuretime) > 0 OR strlen($efnumber) > 0 OR strlen($eiso) > 0) $exif_data .= "::";
if (strlen($emodel) > 0) $exif_data .= "$emodel";
if ($efocal > 0) $exif_data .= " | $efocal" . "mm";
if (strlen($eexposuretime) > 0) $exif_data .= " | $eexposuretime" . "s";
if ($efnumber > 0) $exif_data .= " | f$efnumber";
if (strlen($eiso) > 0) $exif_data .= " | ISO $eiso";
return($exif_data);
}
function checkpermissions($file) {
global $messages;
if (substr(decoct(fileperms($file)), -1, strlen(fileperms($file))) < 4 OR substr(decoct(fileperms($file)), -3,1) < 4) $messages = "At least one file or folder has wrong permissions. Learn how to <a href='http://minigal.dk/faq-reader/items/how-do-i-change-file-permissions-chmod.html' target='_blank'>set file permissions</a>";
}
//-----------------------
// CHECK FOR NEW VERSION
//-----------------------
if (ini_get('allow_url_fopen') == "1") {
$file = @fopen ("http://www.minigal.dk/minigalnano_version.php", "r");
$server_version = fgets ($file, 1024);
if (strlen($server_version) == 5 ) { //If string retrieved is exactly 5 chars then continue
if (version_compare($server_version, $version, '>')) $messages = "MiniGal Nano $server_version is available! <a href='http://www.minigal.dk/minigal-nano.html' target='_blank'>Get it now</a>";
}
fclose($file);
}
if (!defined("GALLERY_ROOT")) define("GALLERY_ROOT", "");
$thumbdir = rtrim('photos' . "/" .$_REQUEST["dir"],"/");
$thumbdir = str_replace("/..", "", $thumbdir); // Prevent looking at any up-level folders
$currentdir = GALLERY_ROOT . $thumbdir;
//-----------------------
// READ FILES AND FOLDERS
//-----------------------
$files = array();
$dirs = array();
if ($handle = opendir($currentdir))
{
while (false !== ($file = readdir($handle)))
{
// 1. LOAD FOLDERS
if (is_directory($currentdir . "/" . $file))
{
if ($file != "." && $file != ".." )
{
checkpermissions($currentdir . "/" . $file); // Check for correct file permission
// Set thumbnail to folder.jpg if found:
if (file_exists("$currentdir/" . $file . "/folder.jpg"))
{
$dirs[] = array(
"name" => $file,
"date" => filemtime($currentdir . "/" . $file . "/folder.jpg"),
"html" => "<li><a href='?dir=" .ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$currentdir/" . $file . "/folder.jpg&amp;size=$thumb_size' alt='$label_loading' /></a></li>");
} else
{
// Set thumbnail to first image found (if any):
unset ($firstimage);
$firstimage = getfirstImage("$currentdir/" . $file);
if ($firstimage != "") {
$dirs[] = array(
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"html" => "<li><a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file, $label_max_length) . "</em><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=$thumbdir/" . $file . "/" . $firstimage . "&amp;size=$thumb_size' alt='$label_loading' /></a></li>");
} else {
// If no folder.jpg or image is found, then display default icon:
$dirs[] = array(
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"html" => "<li><a href='?dir=" . ltrim($_GET['dir'] . "/" . $file, "/") . "'><em>" . padstring($file) . "</em><span></span><img src='" . GALLERY_ROOT . "images/folder_" . strtolower($folder_color) . ".png' width='$thumb_size' height='$thumb_size' alt='$label_loading' /></a></li>");
}
}
}
}
// 2. LOAD CAPTIONS
if (file_exists($currentdir ."/captions.txt"))
{
$file_handle = fopen($currentdir ."/captions.txt", "rb");
while (!feof($file_handle) )
{
$line_of_text = fgets($file_handle);
$parts = explode('/n', $line_of_text);
foreach($parts as $img_capts)
{
list($img_filename, $img_caption) = explode('|', $img_capts);
$img_captions[$img_filename] = $img_caption;
}
}
fclose($file_handle);
}
// 3. LOAD FILES
if ($file != "." && $file != ".." && $file != "folder.jpg")
{
// JPG, GIF and PNG
if (preg_match("/.jpg$|.gif$|.png$/i", $file))
{
//Read EXIF
if ($display_exif == 1) $img_captions[$file] .= readEXIF($currentdir . "/" . $file);
checkpermissions($currentdir . "/" . $file);
$files[] = array (
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href='" . $currentdir . "/" . $file . "' rel='lightbox[billeder]' title='$img_captions[$file]'><span></span><img src='" . GALLERY_ROOT . "createthumb.php?filename=" . $thumbdir . "/" . $file . "&amp;size=$thumb_size' alt='$label_loading' /></a></li>");
}
// Other filetypes
$extension = "";
if (preg_match("/.pdf$/i", $file)) $extension = "PDF"; // PDF
if (preg_match("/.zip$/i", $file)) $extension = "ZIP"; // ZIP archive
if (preg_match("/.rar$|.r[0-9]{2,}/i", $file)) $extension = "RAR"; // RAR Archive
if (preg_match("/.tar$/i", $file)) $extension = "TAR"; // TARball archive
if (preg_match("/.gz$/i", $file)) $extension = "GZ"; // GZip archive
if (preg_match("/.doc$|.docx$/i", $file)) $extension = "DOCX"; // Word
if (preg_match("/.ppt$|.pptx$/i", $file)) $extension = "PPTX"; //Powerpoint
if (preg_match("/.xls$|.xlsx$/i", $file)) $extension = "XLXS"; // Excel
if ($extension != "")
{
$files[] = array (
"name" => $file,
"date" => filemtime($currentdir . "/" . $file),
"size" => filesize($currentdir . "/" . $file),
"html" => "<li><a href='" . $currentdir . "/" . $file . "' title='$file'><em-pdf>" . padstring($file, 20) . "</em-pdf><span></span><img src='" . GALLERY_ROOT . "images/filetype_" . $extension . ".png' width='$thumb_size' height='$thumb_size' alt='$file' /></a></li>");
}
}
}
closedir($handle);
} else die("ERROR: Could not open $currentdir for reading!");
//-----------------------
// SORT FILES AND FOLDERS
//-----------------------
if (sizeof($dirs) > 0)
{
foreach ($dirs as $key => $row)
{
if($row["name"] == "") unset($dirs[$key]); //Delete empty array entries
$name[$key] = strtolower($row['name']);
$date[$key] = strtolower($row['date']);
}
if (strtoupper($sortdir_folders) == "DESC") array_multisort($$sorting_folders, SORT_DESC, $name, SORT_DESC, $dirs);
else array_multisort($$sorting_folders, SORT_ASC, $name, SORT_ASC, $dirs);
}
if (sizeof($files) > 0)
{
foreach ($files as $key => $row)
{
if($row["name"] == "") unset($files[$key]); //Delete empty array entries
$name[$key] = strtolower($row['name']);
$date[$key] = strtolower($row['date']);
$size[$key] = strtolower($row['size']);
}
if (strtoupper($sortdir_files) == "DESC") array_multisort($$sorting_files, SORT_DESC, $name, SORT_ASC, $files);
else array_multisort($$sorting_files, SORT_ASC, $name, SORT_ASC, $files);
}
//-----------------------
// OFFSET DETERMINATION
//-----------------------
$offset_start = ($_GET["page"] * $thumbs_pr_page) - $thumbs_pr_page;
if (!isset($_GET["page"])) $offset_start = 0;
$offset_end = $offset_start + $thumbs_pr_page;
if ($offset_end > sizeof($dirs) + sizeof($files)) $offset_end = sizeof($dirs) + sizeof($files);
if ($_GET["page"] == "all")
{
$offset_start = 0;
$offset_end = sizeof($dirs) + sizeof($files);
}
//-----------------------
// PAGE NAVIGATION
//-----------------------
if (!isset($_GET["page"])) $_GET["page"] = 1;
if (sizeof($dirs) + sizeof($files) > $thumbs_pr_page)
{
$page_navigation .= "$label_page ";
for ($i=1; $i <= ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page); $i++)
{
if ($_GET["page"] == $i)
$page_navigation .= "$i";
else
$page_navigation .= "<a href='?dir=" . $_GET["dir"] . "&amp;page=" . ($i) . "'>" . $i . "</a>";
if ($i != ceil((sizeof($files) + sizeof($dirs)) / $thumbs_pr_page)) $page_navigation .= " | ";
}
//Insert link to view all images
if ($_GET["page"] == "all") $page_navigation .= " | $label_all";
else $page_navigation .= " | <a href='?dir=" . $_GET["dir"] . "&amp;page=all'>$label_all</a>";
}
//-----------------------
// BREADCRUMB NAVIGATION
//-----------------------
if ($_GET['dir'] != "")
{
$breadcrumb_navigation .= "<a href='?dir='>" . $label_home . "</a> > ";
$navitems = explode("/", $_REQUEST['dir']);
for($i = 0; $i < sizeof($navitems); $i++)
{
if ($i == sizeof($navitems)-1) $breadcrumb_navigation .= $navitems[$i];
else
{
$breadcrumb_navigation .= "<a href='?dir=";
for ($x = 0; $x <= $i; $x++)
{
$breadcrumb_navigation .= $navitems[$x];
if ($x < $i) $breadcrumb_navigation .= "/";
}
$breadcrumb_navigation .= "'>" . $navitems[$i] . "</a> > ";
}
}
} else $breadcrumb_navigation .= $label_home;
//Include hidden links for all images BEFORE current page so lightbox is able to browse images on different pages
for ($y = 0; $y < $offset_start - sizeof($dirs); $y++)
{
$breadcrumb_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]' class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
}
//-----------------------
// DISPLAY FOLDERS
//-----------------------
if (count($dirs) + count($files) == 0) {
$thumbnails .= "<li>$label_noimages</li>"; //Display 'no images' text
if($currentdir == "photos") $messages = "It looks like you have just installed MiniGal Nano. Please run the <a href='system_check.php'>system check tool</a>";
}
$offset_current = $offset_start;
for ($x = $offset_start; $x < sizeof($dirs) && $x < $offset_end; $x++)
{
$offset_current++;
$thumbnails .= $dirs[$x]["html"];
}
//-----------------------
// DISPLAY FILES
//-----------------------
for ($i = $offset_start - sizeof($dirs); $i < $offset_end && $offset_current < $offset_end; $i++)
{
if ($i >= 0)
{
$offset_current++;
$thumbnails .= $files[$i]["html"];
}
}
//Include hidden links for all images AFTER current page so lightbox is able to browse images on different pages
for ($y = $i; $y < sizeof($files); $y++)
{
$page_navigation .= "<a href='" . $currentdir . "/" . $files[$y]["name"] . "' rel='lightbox[billeder]' class='hidden' title='" . $img_captions[$files[$y]["name"]] . "'></a>";
}
//-----------------------
// OUTPUT MESSAGES
//-----------------------
if ($messages != "") {
$messages = "<div id=\"topbar\">" . $messages . " <a href=\"#\" onclick=\"document.getElementById('topbar').style.display = 'none';\";><img src=\"images/close.png\" /></a></div>";
}
//PROCESS TEMPLATE FILE
if(GALLERY_ROOT != "") $templatefile = GALLERY_ROOT . "templates/integrate.html";
else $templatefile = "templates/" . $templatefile . ".html";
if(!$fd = fopen($templatefile, "r"))
{
echo "Template $templatefile not found!";
exit();
}
else
{
$template = fread ($fd, filesize ($templatefile));
fclose ($fd);
$template = stripslashes($template);
$template = preg_replace("/<% title %>/", $title, $template);
$template = preg_replace("/<% messages %>/", $messages, $template);
$template = preg_replace("/<% author %>/", $author, $template);
$template = preg_replace("/<% gallery_root %>/", GALLERY_ROOT, $template);
$template = preg_replace("/<% images %>/", "$images", $template);
$template = preg_replace("/<% thumbnails %>/", "$thumbnails", $template);
$template = preg_replace("/<% breadcrumb_navigation %>/", "$breadcrumb_navigation", $template);
$template = preg_replace("/<% page_navigation %>/", "$page_navigation", $template);
$template = preg_replace("/<% bgcolor %>/", "$backgroundcolor", $template);
$template = preg_replace("/<% gallery_width %>/", "$gallery_width", $template);
$template = preg_replace("/<% version %>/", "$version", $template);
echo "$template";
}
//-----------------------
//Debug stuff
//-----------------------
/* $mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo "This page was created in ".$totaltime." seconds";
*/
?>

7
integrate.php Normal file
View file

@ -0,0 +1,7 @@
<?php
$path_to_minigalnano = "minigalnano/"; // <- Enter RELATIVE path to MiniGal Nano here (eg. "subfolder/minigalnano") - DO NOT END WITH /
// DO NOT EDIT BELOW THIS LINE!
define("GALLERY_ROOT", $path_to_minigalnano);
require(GALLERY_ROOT . "index.php");
?>

956
js/mediaboxAdv-1.3.4b.js Normal file
View file

@ -0,0 +1,956 @@
/*
mediaboxAdvanced v1.3.4b - The ultimate extension of Slimbox and Mediabox; an all-media script
updated 2010.09.21
(c) 2007-2010 John Einselen <http://iaian7.com>
based on Slimbox v1.64 - The ultimate lightweight Lightbox clone
(c) 2007-2008 Christophe Beyls <http://www.digitalia.be>
MIT-style license.
*/
var Mediabox;
(function() {
// Global variables, accessible to Mediabox only
var options, images, activeImage, prevImage, nextImage, top, mTop, left, mLeft, winWidth, winHeight, fx, preload, preloadPrev = new Image(), preloadNext = new Image(), foxfix = false, iefix = false,
// DOM elements
overlay, center, image, bottom, captionSplit, title, caption, prevLink, number, nextLink,
// Mediabox specific vars
URL, WH, WHL, elrel, mediaWidth, mediaHeight, mediaType = "none", mediaSplit, mediaId = "mediaBox", mediaFmt, margin;
/* Initialization */
window.addEvent("domready", function() {
// Create and append the Mediabox HTML code at the bottom of the document
document.id(document.body).adopt(
$$([
overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),
center = new Element("div", {id: "mbCenter"})
]).setStyle("display", "none")
);
image = new Element("div", {id: "mbImage"}).injectInside(center);
bottom = new Element("div", {id: "mbBottom"}).injectInside(center).adopt(
closeLink = new Element("a", {id: "mbCloseLink", href: "#"}).addEvent("click", close),
nextLink = new Element("a", {id: "mbNextLink", href: "#"}).addEvent("click", next),
prevLink = new Element("a", {id: "mbPrevLink", href: "#"}).addEvent("click", previous),
title = new Element("div", {id: "mbTitle"}),
number = new Element("div", {id: "mbNumber"}),
caption = new Element("div", {id: "mbCaption"})
);
fx = {
overlay: new Fx.Tween(overlay, {property: "opacity", duration: 360}).set(0),
image: new Fx.Tween(image, {property: "opacity", duration: 360, onComplete: captionAnimate}),
bottom: new Fx.Tween(bottom, {property: "opacity", duration: 240}).set(0)
};
});
/* API */
Mediabox = {
close: function(){
close(); // Thanks to Yosha on the google group for fixing the close function API!
},
open: function(_images, startImage, _options) {
options = $extend({
text: ['<big>&laquo;</big>','<big>&raquo;</big>','<big>&times;</big>'], // Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)
// text: ['<big>«</big>','<big>»</big>','<big>×</big>'], // Set "previous", "next", and "close" button content (HTML code should be written as entity codes or properly escaped)
// example text: ['<b>P</b>rev','<b>N</b>ext','<b>C</b>lose'],
loop: true, // Allows to navigate between first and last images
keyboard: true, // Enables keyboard control; escape key, left arrow, and right arrow
alpha: true, // Adds 'x', 'c', 'p', and 'n' when keyboard control is also set to true
stopKey: false, // Stops all default keyboard actions while overlay is open (such as up/down arrows)
// Does not apply to iFrame content, does not affect mouse scrolling
overlayOpacity: 0.7, // 1 is opaque, 0 is completely transparent (change the color in the CSS file)
resizeOpening: true, // Determines if box opens small and grows (true) or starts at larger size (false)
resizeDuration: 240, // Duration of each of the box resize animations (in milliseconds)
resizeTransition: false, // Mootools transition effect (false leaves it at the default)
initialWidth: 320, // Initial width of the box (in pixels)
initialHeight: 180, // Initial height of the box (in pixels)
defaultWidth: 640, // Default width of the box (in pixels) for undefined media (MP4, FLV, etc.)
defaultHeight: 360, // Default height of the box (in pixels) for undefined media (MP4, FLV, etc.)
showCaption: true, // Display the title and caption, true / false
showCounter: true, // If true, a counter will only be shown if there is more than 1 image to display
counterText: '({x} / {y})', // Translate or change as you wish
// Image options
imgBackground: false, // Embed images as CSS background (true) or <img> tag (false)
// CSS background is naturally non-clickable, preventing downloads
// IMG tag allows automatic scaling for smaller screens
// (all images have no-click code applied, albeit not Opera compatible. To remove, comment lines 212 and 822)
imgPadding: 100, // Clearance necessary for images larger than the window size (only used when imgBackground is false)
// Change this number only if the CSS style is significantly divergent from the original, and requires different sizes
// Inline options
// overflow: 'auto', // If set, overides CSS settings for inline content only
// Global media options
html5: 'true', // HTML5 settings for YouTube and Vimeo, false = off, true = on
scriptaccess: 'true', // Allow script access to flash files
fullscreen: 'true', // Use fullscreen
fullscreenNum: '1', // 1 = true
autoplay: 'true', // Plays the video as soon as it's opened
autoplayNum: '1', // 1 = true
autoplayYes: 'yes', // yes = true
volume: '100', // 0-100, used for NonverBlaster and Quicktime players
medialoop: 'true', // Loop video playback, true / false, used for NonverBlaster and Quicktime players
bgcolor: '#000000', // Background color, used for flash and QT media
wmode: 'opaque', // Background setting for Adobe Flash ('opaque' and 'transparent' are most common)
// NonverBlaster
useNB: true, // use NonverBlaster (true) or JW Media Player (false) for .flv and .mp4 files
playerpath: '/js/NonverBlaster.swf', // Path to NonverBlaster.swf
controlColor: '0xFFFFFF', // set the controlbar color
controlBackColor: '0x000000', // set the controlbar color
showTimecode: 'false', // turn timecode display off or on
// JW Media Player settings and options
JWplayerpath: '/js/player.swf', // Path to the mediaplayer.swf or flvplayer.swf file
backcolor: '000000', // Base color for the controller, color name / hex value (0x000000)
frontcolor: '999999', // Text and button color for the controller, color name / hex value (0x000000)
lightcolor: '000000', // Rollover color for the controller, color name / hex value (0x000000)
screencolor: '000000', // Rollover color for the controller, color name / hex value (0x000000)
controlbar: 'over', // bottom, over, none (this setting is ignored when playing audio files)
// Quicktime options
controller: 'true', // Show controller, true / false
// Flickr options
flInfo: 'true', // Show title and info at video start
// Revver options
revverID: '187866', // Revver affiliate ID, required for ad revinue sharing
revverFullscreen: 'true', // Fullscreen option
revverBack: '000000', // Background color
revverFront: 'ffffff', // Foreground color
revverGrad: '000000', // Gradation color
// Ustream options
usViewers: 'true', // Show online viewer count (true/false)
// Youtube options
ytBorder: '0', // Outline (1=true, 0=false)
ytColor1: '000000', // Outline color
ytColor2: '333333', // Base interface color (highlight colors stay consistent)
ytQuality: '&ap=%2526fmt%3D18', // Leave empty for standard quality, use '&ap=%2526fmt%3D18' for high quality, and '&ap=%2526fmt%3D22' for HD (note that not all videos are availible in high quality, and very few in HD)
ytRel: '0', // Show related videos (1=true, 0=false)
ytInfo: '1', // Show video info (1=true, 0=false)
ytSearch: '0', // Show search field (1=true, 0=false)
// Viddyou options
vuPlayer: 'basic', // Use 'full' or 'basic' players
// Vimeo options
vmTitle: '1', // Show video title
vmByline: '1', // Show byline
vmPortrait: '1', // Show author portrait
vmColor: 'ffffff' // Custom controller colors, hex value minus the # sign, defult is 5ca0b5
}, _options || {});
prevLink.set('html', options.text[0]);
nextLink.set('html', options.text[1]);
closeLink.set('html', options.text[2]);
margin = center.getStyle('padding-left').toInt()+image.getStyle('margin-left').toInt()+image.getStyle('padding-left').toInt();
if ((Browser.Engine.gecko) && (Browser.Engine.version<19)) { // Fixes Firefox 2 and Camino 1.6 incompatibility with opacity + flash
foxfix = true;
options.overlayOpacity = 1;
overlay.className = 'mbOverlayFF';
}
if ((Browser.Engine.trident) && (Browser.Engine.version<5)) { // Fixes IE 6 and earlier incompatibilities with CSS position: fixed;
iefix = true;
overlay.className = 'mbOverlayIE';
overlay.setStyle("position", "absolute");
position();
}
if (typeof _images == "string") { // Used for single images only, with URL and Title as first two arguments
_images = [[_images,startImage,_options]];
startImage = 0;
}
images = _images;
options.loop = options.loop && (images.length > 1);
size();
setup(true);
top = window.getScrollTop() + (window.getHeight()/2);
left = window.getScrollLeft() + (window.getWidth()/2);
fx.resize = new Fx.Morph(center, $extend({duration: options.resizeDuration, onComplete: imageAnimate}, options.resizeTransition ? {transition: options.resizeTransition} : {}));
center.setStyles({top: top, left: left, width: options.initialWidth, height: options.initialHeight, marginTop: -(options.initialHeight/2)-margin, marginLeft: -(options.initialWidth/2)-margin, display: ""});
fx.overlay.start(options.overlayOpacity);
return changeImage(startImage);
}
};
Element.implement({
mediabox: function(_options, linkMapper) {
$$(this).mediabox(_options, linkMapper); // The processing of a single element is similar to the processing of a collection with a single element
return this;
}
});
Elements.implement({
/*
options: Optional options object, see Mediabox.open()
linkMapper: Optional function taking a link DOM element and an index as arguments and returning an array containing 3 elements:
the image URL and the image caption (may contain HTML)
linksFilter:Optional function taking a link DOM element and an index as arguments and returning true if the element is part of
the image collection that will be shown on click, false if not. "this" refers to the element that was clicked.
This function must always return true when the DOM element argument is "this".
*/
mediabox: function(_options, linkMapper, linksFilter) {
linkMapper = linkMapper || function(el) {
elrel = el.rel.split(/[\[\]]/);
elrel = elrel[1];
return [el.href, el.title, elrel];
};
linksFilter = linksFilter || function() {
return true;
};
var links = this;
links.addEvent('contextmenu', function(e){
if (this.toString().match(/\.gif|\.jpg|\.jpeg|\.png/i)) e.stop();
});
links.removeEvents("click").addEvent("click", function() {
// Build the list of images that will be displayed
var filteredArray = links.filter(linksFilter, this);
var filteredLinks = [];
var filteredHrefs = [];
filteredArray.each(function(item, index){
if(filteredHrefs.indexOf(item.toString()) < 0) {
filteredLinks.include(filteredArray[index]);
filteredHrefs.include(filteredArray[index].toString());
};
});
return Mediabox.open(filteredLinks.map(linkMapper), filteredHrefs.indexOf(this.toString()), _options);
});
return links;
}
});
/* Internal functions */
function position() {
overlay.setStyles({top: window.getScrollTop(), left: window.getScrollLeft()});
}
function size() {
winWidth = window.getWidth();
winHeight = window.getHeight();
overlay.setStyles({width: winWidth, height: winHeight});
}
function setup(open) {
// Hides on-page objects and embeds while the overlay is open, nessesary to counteract Firefox stupidity
if (Browser.Engine.gecko) {
["object", window.ie ? "select" : "embed"].forEach(function(tag) {
Array.forEach(document.getElementsByTagName(tag), function(el) {
if (open) el._mediabox = el.style.visibility;
el.style.visibility = open ? "hidden" : el._mediabox;
});
});
}
overlay.style.display = open ? "" : "none";
var fn = open ? "addEvent" : "removeEvent";
if (iefix) window[fn]("scroll", position);
window[fn]("resize", size);
if (options.keyboard) document[fn]("keydown", keyDown);
}
function keyDown(event) {
if (options.alpha) {
switch(event.code) {
case 27: // Esc
case 88: // 'x'
case 67: // 'c'
close();
break;
case 37: // Left arrow
case 80: // 'p'
previous();
break;
case 39: // Right arrow
case 78: // 'n'
next();
}
} else {
switch(event.code) {
case 27: // Esc
close();
break;
case 37: // Left arrow
previous();
break;
case 39: // Right arrow
next();
}
}
if (options.stopKey) { return false; };
}
function previous() {
return changeImage(prevImage);
}
function next() {
return changeImage(nextImage);
}
function changeImage(imageIndex) {
if (imageIndex >= 0) {
image.set('html', '');
activeImage = imageIndex;
prevImage = ((activeImage || !options.loop) ? activeImage : images.length) - 1;
nextImage = activeImage + 1;
if (nextImage == images.length) nextImage = options.loop ? 0 : -1;
stop();
center.className = "mbLoading";
/* mediaboxAdvanced link formatting and media support */
if (!images[imageIndex][2]) images[imageIndex][2] = ''; // Thanks to Leo Feyer for offering this fix
WH = images[imageIndex][2].split(' ');
WHL = WH.length;
if (WHL>1) {
mediaWidth = (WH[WHL-2].match("%")) ? (window.getWidth()*((WH[WHL-2].replace("%", ""))*0.01))+"px" : WH[WHL-2]+"px";
mediaHeight = (WH[WHL-1].match("%")) ? (window.getHeight()*((WH[WHL-1].replace("%", ""))*0.01))+"px" : WH[WHL-1]+"px";
} else {
mediaWidth = "";
mediaHeight = "";
}
URL = images[imageIndex][0];
// URL = encodeURI(URL).replace("(","%28").replace(")","%29");
captionSplit = images[activeImage][1].split('::');
// Quietube and yFrog support
if (URL.match(/quietube\.com/i)) {
mediaSplit = URL.split('v.php/');
URL = mediaSplit[1];
} else if (URL.match(/\/\/yfrog/i)) {
mediaType = (URL.substring(URL.length-1));
if (mediaType.match(/b|g|j|p|t/i)) mediaType = 'image';
if (mediaType == 's') mediaType = 'flash';
if (mediaType.match(/f|z/i)) mediaType = 'video';
URL = URL+":iphone";
}
/* Specific Media Types */
// GIF, JPG, PNG
if (URL.match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i) || mediaType == 'image') {
mediaType = 'img';
URL = URL.replace(/twitpic\.com/i, "twitpic.com/show/full");
preload = new Image();
preload.onload = startEffect;
preload.src = URL;
// FLV, MP4
} else if (URL.match(/\.flv|\.mp4/i) || mediaType == 'video') {
mediaType = 'obj';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = mediaHeight || options.defaultHeight;
if (options.useNB) {
preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
id: 'MediaboxSWF',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
} else {
preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar, {
id: 'MediaboxSWF',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
}
startEffect();
// MP3, AAC
} else if (URL.match(/\.mp3|\.aac|tweetmic\.com|tmic\.fm/i) || mediaType == 'audio') {
mediaType = 'obj';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = mediaHeight || "20px";
if (URL.match(/tweetmic\.com|tmic\.fm/i)) {
URL = URL.split('/');
URL[4] = URL[4] || URL[3];
URL = "http://media4.fjarnet.net/tweet/tweetmicapp-"+URL[4]+'.mp3';
}
if (options.useNB) {
preload = new Swiff(''+options.playerpath+'?mediaURL='+URL+'&allowSmoothing=true&autoPlay='+options.autoplay+'&buffer=6&showTimecode='+options.showTimecode+'&loop='+options.medialoop+'&controlColor='+options.controlColor+'&controlBackColor='+options.controlBackColor+'&defaultVolume='+options.volume+'&scaleIfFullScreen=true&showScalingButton=true&crop=false', {
id: 'MediaboxSWF',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
} else {
preload = new Swiff(''+options.JWplayerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay, {
id: 'MediaboxSWF',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
}
startEffect();
// SWF
} else if (URL.match(/\.swf/i) || mediaType == 'flash') {
mediaType = 'obj';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = mediaHeight || options.defaultHeight;
preload = new Swiff(URL, {
id: 'MediaboxSWF',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// MOV, M4V, M4A, MP4, AIFF, etc.
} else if (URL.match(/\.mov|\.m4v|\.m4a|\.aiff|\.avi|\.caf|\.dv|\.mid|\.m3u|\.mp3|\.mp2|\.mp4|\.qtz/i) || mediaType == 'qt') {
mediaType = 'qt';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = (parseInt(mediaHeight)+16)+"px" || options.defaultHeight;
preload = new Quickie(URL, {
id: 'MediaboxQT',
width: mediaWidth,
height: mediaHeight,
container: 'mbImage',
attributes: {controller: options.controller, autoplay: options.autoplay, volume: options.volume, loop: options.medialoop, bgcolor: options.bgcolor}
});
startEffect();
/* Social Media Sites */
// Blip.tv
} else if (URL.match(/blip\.tv/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "640px";
mediaHeight = mediaHeight || "390px";
preload = new Swiff(URL, {
src: URL,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Break.com
} else if (URL.match(/break\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "464px";
mediaHeight = mediaHeight || "376px";
mediaId = URL.match(/\d{6}/g);
preload = new Swiff('http://embed.break.com/'+mediaId, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// DailyMotion
} else if (URL.match(/dailymotion\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "381px";
preload = new Swiff(URL, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Facebook
} else if (URL.match(/facebook\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "320px";
mediaHeight = mediaHeight || "240px";
mediaSplit = URL.split('v=');
mediaSplit = mediaSplit[1].split('&');
mediaId = mediaSplit[0];
preload = new Swiff('http://www.facebook.com/v/'+mediaId, {
movie: 'http://www.facebook.com/v/'+mediaId,
classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Flickr
} else if (URL.match(/flickr\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "500px";
mediaHeight = mediaHeight || "375px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[5];
preload = new Swiff('http://www.flickr.com/apps/video/stewart.swf', {
id: mediaId,
classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
width: mediaWidth,
height: mediaHeight,
params: {flashvars: 'photo_id='+mediaId+'&amp;show_info_box='+options.flInfo, wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// GameTrailers Video
} else if (URL.match(/gametrailers\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "392px";
mediaId = URL.match(/\d{5}/g);
preload = new Swiff('http://www.gametrailers.com/remote_wrap.php?mid='+mediaId, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Google Video
} else if (URL.match(/google\.com\/videoplay/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "400px";
mediaHeight = mediaHeight || "326px";
mediaSplit = URL.split('=');
mediaId = mediaSplit[1];
preload = new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Megavideo - Thanks to Robert Jandreu for suggesting this code!
} else if (URL.match(/megavideo\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "640px";
mediaHeight = mediaHeight || "360px";
mediaSplit = URL.split('=');
mediaId = mediaSplit[1];
preload = new Swiff('http://wwwstatic.megavideo.com/mv_player.swf?v='+mediaId, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Metacafe
} else if (URL.match(/metacafe\.com\/watch/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "400px";
mediaHeight = mediaHeight || "345px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[4];
preload = new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf?playerVars=autoPlay='+options.autoplayYes, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Myspace
} else if (URL.match(/vids\.myspace\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "425px";
mediaHeight = mediaHeight || "360px";
preload = new Swiff(URL, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Revver
} else if (URL.match(/revver\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "392px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[4];
preload = new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&autoStart='+options.autoplay+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver', {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Rutube
} else if (URL.match(/rutube\.ru/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "470px";
mediaHeight = mediaHeight || "353px";
mediaSplit = URL.split('=');
mediaId = mediaSplit[1];
preload = new Swiff('http://video.rutube.ru/'+mediaId, {
movie: 'http://video.rutube.ru/'+mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Seesmic
} else if (URL.match(/seesmic\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "435px";
mediaHeight = mediaHeight || "355px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[5];
preload = new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Tudou
} else if (URL.match(/tudou\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "400px";
mediaHeight = mediaHeight || "340px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[5];
preload = new Swiff('http://www.tudou.com/v/'+mediaId, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Twitvcam
} else if (URL.match(/twitcam\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "320px";
mediaHeight = mediaHeight || "265px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[3];
preload = new Swiff('http://static.livestream.com/chromelessPlayer/wrappers/TwitcamPlayer.swf?hash='+mediaId, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Twiturm
} else if (URL.match(/twiturm\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "402px";
mediaHeight = mediaHeight || "48px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[3];
preload = new Swiff('http://twiturm.com/flash/twiturm_mp3.swf?playerID=0&sf='+mediaId, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Twitvid
} else if (URL.match(/twitvid\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "600px";
mediaHeight = mediaHeight || "338px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[3];
preload = new Swiff('http://www.twitvid.com/player/'+mediaId, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Ustream.tv
} else if (URL.match(/ustream\.tv/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "400px";
mediaHeight = mediaHeight || "326px";
preload = new Swiff(URL+'&amp;viewcount='+options.usViewers+'&amp;autoplay='+options.autoplay, {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// YouKu
} else if (URL.match(/youku\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "400px";
mediaSplit = URL.split('id_');
mediaId = mediaSplit[1];
preload = new Swiff('http://player.youku.com/player.php/sid/'+mediaId+'=/v.swf', {
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// YouTube Video (now includes HTML5 option)
} else if (URL.match(/youtube\.com\/watch/i)) {
mediaSplit = URL.split('v=');
if (options.html5) {
mediaType = 'url';
mediaWidth = mediaWidth || "640px";
mediaHeight = mediaHeight || "385px";
mediaId = "mediaId_"+new Date().getTime(); // Safari may not update iframe content with a static id.
preload = new Element('iframe', {
'src': 'http://www.youtube.com/embed/'+mediaSplit[1],
'id': mediaId,
'width': mediaWidth,
'height': mediaHeight,
'frameborder': 0
});
startEffect();
} else {
mediaType = 'obj';
mediaId = mediaSplit[1];
if (mediaId.match(/fmt=22/i)) {
mediaFmt = '&ap=%2526fmt%3D22';
mediaWidth = mediaWidth || "640px";
mediaHeight = mediaHeight || "385px";
} else if (mediaId.match(/fmt=18/i)) {
mediaFmt = '&ap=%2526fmt%3D18';
mediaWidth = mediaWidth || "560px";
mediaHeight = mediaHeight || "345px";
} else {
mediaFmt = options.ytQuality;
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "295px";
}
preload = new Swiff('http://www.youtube.com/v/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
}
// YouTube Playlist
} else if (URL.match(/youtube\.com\/view/i)) {
mediaType = 'obj';
mediaSplit = URL.split('p=');
mediaId = mediaSplit[1];
mediaWidth = mediaWidth || "480px";
mediaHeight = mediaHeight || "385px";
preload = new Swiff('http://www.youtube.com/p/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+mediaFmt+'&border='+options.ytBorder+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2+'&rel='+options.ytRel+'&showinfo='+options.ytInfo+'&showsearch='+options.ytSearch, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Veoh
} else if (URL.match(/veoh\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "410px";
mediaHeight = mediaHeight || "341px";
URL = URL.replace('%3D','/');
mediaSplit = URL.split('watch/');
mediaId = mediaSplit[1];
preload = new Swiff('http://www.veoh.com/static/swf/webplayer/WebPlayer.swf?version=AFrontend.5.5.2.1001&permalinkId='+mediaId+'&player=videodetailsembedded&videoAutoPlay='+options.AutoplayNum+'&id=anonymous', {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Viddler
} else if (URL.match(/viddler\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "437px";
mediaHeight = mediaHeight || "370px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[4];
preload = new Swiff(URL, {
id: 'viddler_'+mediaId,
movie: URL,
classid: 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen, id: 'viddler_'+mediaId, movie: URL}
});
startEffect();
// Viddyou
} else if (URL.match(/viddyou\.com/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "416px";
mediaHeight = mediaHeight || "312px";
mediaSplit = URL.split('=');
mediaId = mediaSplit[1];
preload = new Swiff('http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf', {
id: mediaId,
movie: 'http://www.viddyou.com/get/v2_'+options.vuPlayer+'/'+mediaId+'.swf',
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
// Vimeo (now includes HTML5 option)
} else if (URL.match(/vimeo\.com/i)) {
mediaWidth = mediaWidth || "640px"; // site defualt: 400px
mediaHeight = mediaHeight || "360px"; // site defualt: 225px
mediaSplit = URL.split('/');
mediaId = mediaSplit[3];
if (options.html5) {
mediaType = 'url';
mediaId = "mediaId_"+new Date().getTime(); // Safari may not update iframe content with a static id.
preload = new Element('iframe', {
'src': 'http://player.vimeo.com/video/'+mediaSplit[3]+'?portrait='+options.vmPortrait,
'id': mediaId,
'width': mediaWidth,
'height': mediaHeight,
'frameborder': 0
});
startEffect();
} else {
mediaType = 'obj';
preload = new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&amp;server=www.vimeo.com&amp;fullscreen='+options.fullscreenNum+'&amp;autoplay='+options.autoplayNum+'&amp;show_title='+options.vmTitle+'&amp;show_byline='+options.vmByline+'&amp;show_portrait='+options.vmPortrait+'&amp;color='+options.vmColor, {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
}
// 12seconds
} else if (URL.match(/12seconds\.tv/i)) {
mediaType = 'obj';
mediaWidth = mediaWidth || "430px";
mediaHeight = mediaHeight || "360px";
mediaSplit = URL.split('/');
mediaId = mediaSplit[5];
preload = new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf', {
id: mediaId,
width: mediaWidth,
height: mediaHeight,
params: {flashvars: 'vid='+mediaId+'', wmode: options.wmode, bgcolor: options.bgcolor, allowscriptaccess: options.scriptaccess, allowfullscreen: options.fullscreen}
});
startEffect();
/* Specific Content Types */
// INLINE
} else if (URL.match(/\#mb_/i)) {
mediaType = 'inline';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = mediaHeight || options.defaultHeight;
URLsplit = URL.split('#');
preload = document.id(URLsplit[1]).get('html');
startEffect();
// HTML
} else {
mediaType = 'url';
mediaWidth = mediaWidth || options.defaultWidth;
mediaHeight = mediaHeight || options.defaultHeight;
mediaId = "mediaId_"+new Date().getTime(); // Safari may not update iframe content with a static id.
preload = new Element('iframe', {
'src': URL,
'id': mediaId,
'width': mediaWidth,
'height': mediaHeight,
'frameborder': 0
});
startEffect();
}
}
return false;
}
function startEffect() {
if (mediaType == "img"){
mediaWidth = preload.width;
mediaHeight = preload.height;
if (options.imgBackground) {
image.setStyles({backgroundImage: "url("+URL+")", display: ""});
} else { // Thanks to Dusan Medlin for fixing large 16x9 image errors in a 4x3 browser
if (mediaHeight >= winHeight-options.imgPadding && (mediaHeight / winHeight) >= (mediaWidth / winWidth)) {
mediaHeight = winHeight-options.imgPadding;
mediaWidth = preload.width = parseInt((mediaHeight/preload.height)*mediaWidth);
preload.height = mediaHeight;
} else if (mediaWidth >= winWidth-options.imgPadding && (mediaHeight / winHeight) < (mediaWidth / winWidth)) {
mediaWidth = winWidth-options.imgPadding;
mediaHeight = preload.height = parseInt((mediaWidth/preload.width)*mediaHeight);
preload.width = mediaWidth;
}
if (Browser.Engine.trident) preload = document.id(preload);
preload.addEvent('mousedown', function(e){ e.stop(); }).addEvent('contextmenu', function(e){ e.stop(); });
image.setStyles({backgroundImage: "none", display: ""});
preload.inject(image);
}
} else if (mediaType == "obj") {
if (Browser.Plugins.Flash.version<8) {
image.setStyles({backgroundImage: "none", display: ""});
image.set('html', '<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date, please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>');
mediaWidth = options.DefaultWidth;
mediaHeight = options.DefaultHeight;
} else {
image.setStyles({backgroundImage: "none", display: ""});
preload.inject(image);
}
} else if (mediaType == "qt") {
image.setStyles({backgroundImage: "none", display: ""});
preload;
} else if (mediaType == "inline") {
// if (options.overflow) image.setStyles({overflow: options.overflow});
image.setStyles({backgroundImage: "none", display: ""});
image.set('html', preload);
} else if (mediaType == "url") {
image.setStyles({backgroundImage: "none", display: ""});
preload.inject(image);
} else {
image.setStyles({backgroundImage: "none", display: ""});
image.set('html', '<div id="mbError"><b>Error</b><br/>A file type error has occoured, please visit <a href="iaian7.com/webcode/mediaboxAdvanced" title="mediaboxAdvanced" target="_new">iaian7.com</a> or contact the website author for more information.</div>');
mediaWidth = options.defaultWidth;
mediaHeight = options.defaultHeight;
}
image.setStyles({width: mediaWidth, height: mediaHeight});
caption.setStyles({width: mediaWidth});
title.set('html', (options.showCaption) ? captionSplit[0] : "");
caption.set('html', (options.showCaption && (captionSplit.length > 1)) ? captionSplit[1] : "");
number.set('html', (options.showCounter && (images.length > 1)) ? options.counterText.replace(/{x}/, activeImage + 1).replace(/{y}/, images.length) : "");
if ((prevImage >= 0) && (images[prevImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadPrev.src = images[prevImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");
if ((nextImage >= 0) && (images[nextImage][0].match(/\.gif|\.jpg|\.jpeg|\.png|twitpic\.com/i))) preloadNext.src = images[nextImage][0].replace(/twitpic\.com/i, "twitpic.com/show/full");
mediaWidth = image.offsetWidth;
mediaHeight = image.offsetHeight+bottom.offsetHeight;
if (mediaHeight >= top+top) { mTop = -top } else { mTop = -(mediaHeight/2) };
if (mediaWidth >= left+left) { mLeft = -left } else { mLeft = -(mediaWidth/2) };
if (options.resizeOpening) { fx.resize.start({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin});
} else { center.setStyles({width: mediaWidth, height: mediaHeight, marginTop: mTop-margin, marginLeft: mLeft-margin}); imageAnimate(); }
}
function imageAnimate() {
fx.image.start(1);
}
function captionAnimate() {
center.className = "";
if (prevImage >= 0) prevLink.style.display = "";
if (nextImage >= 0) nextLink.style.display = "";
fx.bottom.start(1);
}
function stop() {
if (preload) preload.onload = $empty;
fx.resize.cancel();
fx.image.cancel().set(0);
fx.bottom.cancel().set(0);
$$(prevLink, nextLink).setStyle("display", "none");
}
function close() {
if (activeImage >= 0) {
preload.onload = $empty;
image.set('html', '');
for (var f in fx) fx[f].cancel();
center.setStyle("display", "none");
fx.overlay.chain(setup).start(0);
}
return false;
}
})();
/* Autoload code block */
Mediabox.scanPage = function() {
// $$('#mb_').each(function(hide) { hide.set('display', 'none'); });
var links = $$("a").filter(function(el) {
return el.rel && el.rel.test(/^lightbox/i);
});
$$(links).mediabox({/* Put custom options here */}, null, function(el) {
var rel0 = this.rel.replace(/[[]|]/gi," ");
var relsize = rel0.split(" ");
return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1]));
});
};
window.addEvent("domready", Mediabox.scanPage);

5800
js/mootools.js Normal file

File diff suppressed because it is too large Load diff

127
system_check.php Normal file
View file

@ -0,0 +1,127 @@
<?php
ini_set("memory_limit","256M");
$exif = "No";
$gd = "No";
$update = "No";
if (function_exists('exif_read_data')) $exif = "Yes";
if (extension_loaded('gd') && function_exists('gd_info')) $gd = "Yes";
if (ini_get("allow_url_fopen") == 1) $update = "Yes";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex, nofollow">
<title>MiniGal Nano system check</title>
<style type="text/css">
body {
background-color: #daddd8;
font: 12px Arial, Tahoma, "Times New Roman", serif;
}
h1 {
font-size: 30px;
margin: 20px 0 5px 0;
letter-spacing: -2px;
}
div {
line-height: 20px;
}
.left {
width: 300px;
display: inline-table;
background-color: #fdffbe;
padding: 2px;
}
.middle-neutral {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #fdffbe;
padding: 2px;
}
.middle-no {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #ff8181;
padding: 2px;
}
.middle-yes {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #98ffad;
padding: 2px;
}
.right {
width: 600px;
display: inline-table;
background-color: #eaf1ea;
padding: 2px;
}
</style>
<body>
<h1>MiniGal Nano system check</h1>
<div class="left">
PHP Version
</div>
<div class="<?php if(version_compare(phpversion(), "4.0", '>')) echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo phpversion(); ?>
</div>
<div class="right">
<a href="http://www.php.net/" target="_blank">PHP</a> scripting language version 4.0 or greater is needed
</div>
<br />
<div class="left">
GD library support
</div>
<div class="<?php if($gd == "Yes") echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo $gd; ?>
</div>
<div class="right">
<a href="http://www.boutell.com/gd/" target="_blank">GD image manipulation</a> library is used to create thumbnails. Bundled since PHP 4.3
</div>
<br />
<div class="left">
EXIF support
</div>
<div class="<?php if($exif == "Yes") echo 'middle-yes'; else echo 'middle-neutral' ?>">
<?php echo $exif; ?>
</div>
<div class="right">
Ability to extract and display <a href="http://en.wikipedia.org/wiki/Exif" target="_blank">EXIF information</a>. The script will work without it, but not display image information
</div>
<br />
<div class="left">
PHP memory limit
</div>
<div class="middle-neutral">
<?php echo ini_get("memory_limit"); ?>
</div>
<div class="right">
Memory is needed to create thumbnails. Bigger images uses more memory
</div>
<br />
<div class="left">
New version check
</div>
<div class="middle-neutral">
<?php echo $update ?>
</div>
<div class="right">
The ability to check for new version and display this automatically. The script will work without it
</div>
<br /><br />
<a href="http://www.minigal.dk/minigal-nano.html" target="_blank">Support website</a>
| <a href="http://www.minigal.dk/forum" target="_blank">Support forum</a>
</body>
</html>

181
templates/exhibition.html Normal file
View file

@ -0,0 +1,181 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><% title %></title>
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxAdvWhite.css" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<% title %>" href="rss/" /><link>
<script src="<% gallery_root %>js/mootools.js" type="text/javascript"></script>
<script src="<% gallery_root %>js/mediaboxAdv-1.3.4b.js" type="text/javascript"></script>
<style type="text/css">
body {
margin: 0 auto;
padding: 0;
width: <% gallery_width %>;
font: 12px Lucida Sans Unicode, Georgia, sans-serif, Georgia, "Times New Roman", Times, serif;
background: black;
color: #eee;
}
h1 {
font: normal 220%/100% Georgia, Verdana, Arial, sans-serif Unicode, Georgia, "Times New Roman", Times, serif;
margin: 20px 0 5px 0;
letter-spacing: 5px;
}
.credits {
padding-bottom: 5px;
margin: 0 0 30px 0;
font: 120% Georgia, Lucida Sans Unicode, Garamond, Georgia, serif;
}
.credits em {
color: #999;
}
.backlink a {
font-size: 10px;
text-decoration: none;
color: #AAA;
}
.backlink a:hover,
.backlink a:visited:hover {
color: #555;
}
img {
border: none;
}
#page_nav {
color: #999;
clear:both;
text-align: center;
}
#page_nav a:link, #page_nav a:visited, #page_nav a:hover, #page_nav a:visited:hover {
text-decoration: none;
color: #eee;
}
#breadcrumb_nav {
color: #999;
}
#breadcrumb_nav a:link, #breadcrumb_nav a:visited, #breadcrumb_nav a:hover, #breadcrumb_nav a:visited:hover {
text-decoration: none;
color: #eee;
}
a {
color: #eee;
}
#container {
overflow: auto;
width: 100%
}
.hidden {
visibility: hidden;
position:absolute;
top:0;
left:0;
display:inline;
}
#topbar {
border-bottom-color: #afafaf;
border-style: none;
color: black;
position: absolute;
left: 0;
top: 0;
margin: 0;
padding-top: 5px;
float: none;
width: 100%;
height: 25px;
text-align: center;
background-color: #FFFF99;
border-bottom: 1px solid;
}
#topbar a:link, #topbar a:visited, #topbar a:hover, #topbar a:visited:hover {
text-decoration: underline;
color: #000;
}
#topbar img{
position: absolute;
right: 6;
top: 6;
vertical-align: middle;
}
/* ---------- gallery styles start here ----------------------- */
.gallery {
list-style: none;
margin: 0;
padding: 0;
}
.gallery li {
padding: 1px;
margin: 0;
float: left;
position: relative;
width: 120px;
height: 120px;
overflow:hidden;
}
.gallery li:hover img {
background: #ddd;
filter: alpha(opacity=70);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
-moz-opacity: 0.70;
opacity:0.7;
}
.gallery img {
background: #000;
color: #666;
}
.gallery em {
background: #000;
color: #fff;
font-style: normal;
font-size: 12px;
padding: 2px 2px;
display: block;
position: absolute;
top: 90px;
left: 1px;
width: 116px;
height: 20px;
filter: alpha(opacity=60);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=60);
-moz-opacity: 0.60;
opacity:0.6;
}
.gallery em-pdf {
color: #666;
font-style: normal;
font-size: 10px;
padding: 3px 7px;
display: block;
position: absolute;
top: 100px;
left: 0px;
}
.gallery a {
text-decoration: none;
}
.gallery a:hover em {
background: grey;
color: black;
}
</style>
</head>
<body>
<h1><% title %></h1>
<% messages %>
<p class="credits"><em>by: </em><% author %></p>
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
<br /><br />
<div id="container">
<ul class="gallery">
<% thumbnails %>
</ul>
</div>
<br />
<div id="page_nav"><% page_navigation %></div>
<br />
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
<br /><br />
</body>
</html>

149
templates/integrate.html Normal file
View file

@ -0,0 +1,149 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><% title %></title>
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxAdvBlack21.css" type="text/css" media="screen" />
<script src="<% gallery_root %>js/mootools.js" type="text/javascript"></script>
<script src="<% gallery_root %>js/mediaboxAdv-1.3.4b.js" type="text/javascript"></script>
<style type="text/css">
body {
margin: 0 auto;
padding: 0;
width: <% gallery_width %>;
font: 14px Georgia, "Times New Roman", Times, serif;
}
h1 {
font: normal 320%/100% Georgia, "Times New Roman", Times, serif;
margin: 20px 0 5px 0;
letter-spacing: -2px;
}
.credits {
border-bottom: solid 1px #ccc;
padding-bottom: 5px;
margin: 0 0 30px 0;
font: 120% Garamond, Georgia, serif;
}
.credits em {
color: #999;
}
.backlink a {
font-size: 10px;
text-decoration: none;
color: #AAA;
}
.backlink a:hover,
.backlink a:visited:hover {
color: #000;
}
img {
border: none;
}
#page_nav {
color: #999;
clear:both;
text-align: center;
}
#page_nav a:link, #page_nav a:visited, #page_nav a:hover, #page_nav a:visited:hover {
text-decoration: none;
color: #222;
}
#breadcrumb_nav {
color: #999;
}
#breadcrumb_nav a:link, #breadcrumb_nav a:visited, #breadcrumb_nav a:hover, #breadcrumb_nav a:visited:hover {
text-decoration: none;
color: #222;
}
a {
color: black;
}
#container {
overflow: auto;
width: 100%
}
.hidden {
visibility: hidden;
position:absolute;
top:0;
left:0;
display:inline;
}
/* ---------- gallery styles start here ----------------------- */
.gallery {
list-style: none;
margin: 0;
padding: 0;
}
.gallery li {
padding: 10px;
margin: 0;
float: left;
position: relative;
width: 130px;
height: 130px;
}
.gallery li:hover img {
border-color: #000;
background: #ddd;
}
.gallery img {
background: #fff;
border: solid 1px #888;
padding: 5px;
}
.gallery em {
background: #fff url(images/grey-gradient.gif) repeat-y;
color: #000;
font-style: normal;
padding: 2px 10px;
display: block;
position: absolute;
top: 110px;
left: 9px;
border: 1px solid #999;
border-left-color: #888;
}
.gallery a {
text-decoration: none;
}
.gallery a:hover em {
background: #ffdb01 url(images/orange-gradient.gif) repeat-y;
border-color: #c25b08;
}
.newversion {
position: absolute;
right: 0;
top: 0;
margin: 0;
padding: 0;
border: none;
float: none;
}
.newversion a img {
background-color: transparent;
color: white;
border: none;
text-decoration: none;
}
</style>
</head>
<body>
<h1><em><% title %></em></h1>
<p class="credits"><em>by:</em> <% author %></p>
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
<div id="container">
<ul class="gallery">
<% thumbnails %>
</ul>
</div>
<br />
<div id="page_nav"><% page_navigation %></div>
<br />
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
<br /><br />
</body>
</html>

167
templates/mano.html Normal file
View file

@ -0,0 +1,167 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><% title %></title>
<link rel="stylesheet" href="<% gallery_root %>css/mediaboxAdvBlack21.css" type="text/css" media="screen" />
<script src="<% gallery_root %>js/mootools.js" type="text/javascript"></script>
<script src="<% gallery_root %>js/mediaboxAdv-1.3.4b.js" type="text/javascript"></script>
<style type="text/css">
body {
margin: 0 auto;
padding: 0;
width: <% gallery_width %>;
font: 12px geneva, century gothic, Georgia, "Times New Roman", Times, serif;
background: <% bgcolor %>;
}
h1 {
font: italic 320%/100% Georgia, "Times New Roman", Times, serif;
margin: 20px 0 5px 0;
letter-spacing: -2px;
}
.credits {
border-bottom: solid 1px #ccc;
padding-bottom: 5px;
margin: 0 0 30px 0;
font: 120% Garamond, Georgia, serif;
}
.credits em {
color: #999;
}
#bottom {
color: #FFF;
border: 0;
border-top: solid 1px #ccc;
}
.backlink a {
font-size: 10px;
text-decoration: none;
color: #AAA;
}
.backlink a:hover,
.backlink a:visited:hover {
color: #000;
}
img {
border: none;
}
#page_nav {
color: #999;
clear:both;
text-align: center;
}
#page_nav a:link, #page_nav a:visited, #page_nav a:hover, #page_nav a:visited:hover {
text-decoration: none;
color: #222;
}
#breadcrumb_nav {
color: #999;
}
#breadcrumb_nav a:link, #breadcrumb_nav a:visited, #breadcrumb_nav a:hover, #breadcrumb_nav a:visited:hover {
text-decoration: none;
color: #222;
}
a {
color: black;
}
#container {
overflow: auto;
width: 100%
}
.hidden {
visibility: hidden;
position:absolute;
top:0;
left:0;
display:inline;
}
#topbar {
position: absolute;
left: 0;
top: 0;
margin: 0;
padding-top: 5px;
border: none;
float: none;
width: 100%;
height: 25px;
text-align: center;
background-color: #FFFF99;
border-bottom: 1px solid #DDD;
}
#topbar img{
position: absolute;
right: 6;
top: 6;
vertical-align: middle;
}
/* ---------- gallery styles start here ----------------------- */
.gallery {
list-style: none;
margin: 0;
padding: 0;
}
.gallery li {
padding: 10px;
margin: 0;
float: left;
position: relative;
width: 130px;
height: 160px;
overflow:hidden;
}
.gallery li:hover img {
border-color: #000;
background: #ddd;
}
.gallery img {
background: #fff;
border: solid 1px #888;
padding: 5px;
}
.gallery em {
color: #000;
font-style: normal;
padding: 2px 5px;
display: block;
position: absolute;
top: 140px;
left: 9px;
}
.gallery em-pdf {
color: #666;
font-style: normal;
font-size: 10px;
padding: 3px 7px;
display: block;
position: absolute;
top: 118px;
left: 9px;
}
.gallery a {
text-decoration: none;
}
.gallery a:hover em {
color: #666;
}
</style>
<body>
<h1><% title %></h1>
<% messages %>
<p class="credits"><em>by: </em><% author %></p>
<span id="breadcrumb_nav"><% breadcrumb_navigation %></span>
<div id="container">
<ul class="gallery">
<% thumbnails %>
</ul>
</div>
<br />
<div id="page_nav"><% page_navigation %></div>
<br />
<!-- CREDITS - DO NOT REMOVE OR YOU WILL VOID MiniGal Nano TERMS OF USE -->
<hr id="bottom" />
<div class="backlink" align="center"><a href="http://www.minigal.dk" title="Powered by MiniGal Nano" target="_blank">Powered by MiniGal Nano <% version %></a></div>
<br /><br />
</body>
</html>