Hi i get a great code for my movie gallery but is only for .mov file
Is is possible in that:
$film_link= rawurlencode($thumbs[$start]);
$film_link=str_replace(“.gif”,”.mov”,$film_link);
$film_link=str_replace(“.jpg”,”.mov”,$film_link);
To add support to wmv, mpg, asf, avi etc movie file
i pass the full code here.
<html>
<head>
<title>Simple PHP Image Gallery</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<style type=”text/css”>
<!–
/* Default styles incase you don’t have an external css.
body { background-color: rgb(56,56,56); color: rgb(180,180,180); font: 82% verdana, arial, sans-serif }
table { font-size: inherit }
p, td, div { color: rgb(180,180,180); font-family: verdana, arial, sans-serif }
h2 { font-size: 1.2em; font-weight: bold }
h2, p { text-align: center }
a:link, a:active, a:visited { color: #708090; text-decoration: none; font-size: 12px }
a:hover { text-decoration: underline }
/* the following styles must be included somewhere, since they controll all formatting
#photo { text-align: center }
#photo table { width: 80%; text-align: center; margin-right: auto; margin-left: auto }
#photo table td { padding: 0px 10px 10px 10px }
#photo .fulltitle { margin-bottom: 0px; padding-bottom: 0px }
#photo .series { margin-top: 0px; padding-top: 0px }
br.hideme { visibility: hidden; volume: silent }
/* hidden from netscape 4:
div#photo img { border: 1px solid #708090 }
div#photo .caption { text-align: left; width: 500px; margin-right: auto; margin-left: auto }
–>
</style>
<!–link rel=”stylesheet” href=”../style.css” type=”text/css” /–>
</head>
<body>
<p>Les vidéos drôles </p>
<!– start of image gallery “stuff” –>
<div id=”photo”>
<?
//error_reporting (E_ALL);
/***********************************************************************
########################################################################
/***********************************************************************
// 1 for XHTML or 0 for HTML?
$xhtml = 1;
// thumbnail directory name
$thumbs_dir = ‘thumbs’;
// full size image directory name
$full_dir = ‘movies’;
// captions directory name (captions are option, ignore if you dont’ have any)
$captions_dir = ‘captions’;
// thumbnails title (1 to show, 0 to hide)
$thumb_title = 1;
// full size images title (1 to show, 0 to hide)
$full_title = 1;
// kill beginning numbers for the title (1 to hide, 0 to show)
// hiding would make 0005_baby_pic.jpg have a title of ‘Baby pic’
$kill_title_nums = 1;
// how many thumbnails should appear per row? (3 usually looks best)
$cols = 3;
// how many thumbnails per page? (a multiple of $cols, or 0 for all)
$max_thumbs = 9;
// extension name (if your server is not set for “index.$ext to be the index page, put 0)
$ext = ‘php’;
// captions extension
$cext = ‘inc’; // use whatever you’re comfortable with
// show random option for single page view (1 to show, 0 to hide)
$showrand = 0;
// closing (X)HTML options
// if you use a function to close your code, put that in, otherwise leave as is
$print_footer = ‘print_footer’;
/***********************************************************************
// figure out this script’s name
$self = $_SERVER[‘PHP_SELF’];
if (basename($self) == “index.$ext”) {
$self = str_replace(basename($self), ”, $self);
}
// do you have an existing function to close your page? if not, use this default…
if (!function_exists($print_footer)) {
function print_gallery_footer() {
?>
</body>
</html>
<?
}
$print_footer = ‘print_gallery_footer’;
}
// our error function, cleanly exits the script on user errors
function imgerror($error) {
global $print_footer;
print “<p><b>$error</b></p>nn”;
$print_footer();
exit();
}
// check to see which kind of closing tag we should use
$close_tag = !empty($xhtml) ? ‘ />’ : ‘>’;
// check for directories
if (!is_dir($thumbs_dir)) {
imgerror(‘Directory “‘.$thumbs_dir.'” does not exist.’);
}
if (!is_dir($full_dir)) {
imgerror(‘Directory “‘.$full_dir.'” does not exist.’);
}
// get contents of $thumbs_dir
$dir = @opendir($thumbs_dir) or imgerror(‘Can’t open ‘ . $thumbs_dir . ‘ directory’);
while (($thumb = readdir($dir)) !== false) {
if (preg_match(‘/((?i)jpg|jpeg|gif|tif|bmp|png)$/’, $thumb))
$thumbs[] = $thumb;
}
rsort($thumbs);
$thumbs_size = sizeof($thumbs);
// lowest displayed image in the array
// use http_get_vars incase register_globals is off in php.ini
$i = !empty($_GET[‘i’]) ? $
$random = array_rand($thumbs, 2);
$i = $i === ‘rand’ ? $thumbs[$random[rand(0, 1)]] : $i;
// check to see if all thumbs are meant to be displayed on one page
if ($max_thumbs == 0) {
$max_thumbs = $thumbs_size;
$mt_check = 1;
}
// thumbnail view
if (is_numeric($i)) {
// check to see which thumbnail to start with
$start = empty($mt_check) && $i > 0 ? $max_thumbs * ($i – 1) : 0;
// are they looking for thumbs pages that don’t exist?
if ($start >= $thumbs_size) {
print ‘<a href=”‘ . $self . ‘”>index</a>’ . “nn”;
imgerror(‘Sorry, there are no images to display on this page’);
}
?>
<table>
<tr>
<?
// loop through $thumbs and display $max_thumbs per page
for ($count = 1; $count <= $max_thumbs; $start++) {
// break if past max_thumbs
if ($start >= $thumbs_size) {
break;
}
// print new row after predefined number of thumbnails
if (($count % $cols == 1) && $count != 1 && $cols > 1) {
print “</tr>nn<tr>n”;
} elseif ($cols == 1) {
print “</tr>nn<tr>n”;
}
// open cell
print ‘<td align=”center” style=”width: ‘ . (floor(100 / $cols)) . ‘%”>’;
// insert thumb
$film_link= rawurlencode($thumbs[$start]);
$film_link=str_replace(“.gif”,”.mov”,$film_link);
$film_link=str_replace(“.jpg”,”.mov”,$film_link);
print ‘<a href=”‘ . $self . ‘?i=’ . $film_link . ‘”>’;
print ‘<img src=”‘ . $thumbs_dir . ‘/’ . rawurlencode($thumbs[$start]) . ‘” ‘;
list($width, $height) = getimagesize(“$thumbs_dir/$thumbs[$start]”);
print ‘width=”‘ . $width . ‘” height=”‘ . $height . ‘”‘;
// alt information
print ‘ alt=”Link to full sized version of ‘ . $thumbs[$start] . ‘”‘ . $close_tag . ‘</a>’;
// image title
if ($thumb_title) {
if ($kill_title_nums) {
$title = ltrim(ltrim(str_replace(‘_’, ‘ ‘, $thumbs[$start]), “0..9”));
} else {
$title = ltrim(str_replace(‘_’, ‘ ‘, $thumbs[$start]));
}
$title = explode(“.”, ucfirst($title));
print ‘<br’ . $close_tag . “n” . $title[0];
}
// close cell
// supress line break for screen readers, but force a line break for lynx
print ‘<br class=”hideme”‘ . $close_tag . ‘</td>’ . “n”;
$count++;
}
?>
</tr>
</table>
<?
// thumbs page nav
if (!$mt_check) {
print “n<p>”;
// how many total thumbs pages, including a “remainder” page if needed
$pages = ceil($thumbs_size / $max_thumbs);
for ($count = 1; $count <= $pages; $count++) {
if ($count == 1) {
if ($count == $i || $i == 0) {
print $count;
} else {
print “<a href=”$self”>$count</a>”;
}
} else {
if ($count == $i) {
print ” | $count</a>”;
} else {
print ” | <a href=”$self?i=$count”>$count</a>”;
}
}
}
print ‘</p>’;
}
}
// single image view
else if (file_exists(“$full_dir/$i”)) {
// find where it is in the array
$key = array_search($i, $thumbs);
if (is_null($key)) {
$key = -1;
}
// navigation
print ‘<p>’;
// index
print ‘<a href=”‘ . $self . ‘”>index</a>’;
print “</p>nn”;
// image
print ‘<object classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” width=”320″ height=”256″ id=”320×240″ name=”sorrytime” align=”middle”>
<param name=”controller” value=”true”>
<param name=”src” value=”‘ . $full_dir . ‘/’ . $i . ‘”>
<param name=”autoplay” value=”true”>
<param name=”bgcolor” value=”#ffffff”>
<embed src=”‘ . $full_dir . ‘/’ . $i . ‘”
bgcolor=”#ffffff” width=”320″ height=”256″ name=”sorrytime” align=”middle” type=”video/quicktime” autoplay=”true” controller=”true”></embed></object>’;
// alt information
if ($full_title) {
if ($kill_title_nums) {
$title = $title = ltrim(ltrim(str_replace(‘_’, ‘ ‘, $i), “0..9”));
} else {
$title = ltrim(str_replace(‘_’, ‘ ‘, $i));
}
$title = explode(‘.’, ucfirst($title));
print “<br><br><div class=”fulltitle”>$title[0]</div>nn”;
}
// numerically show what image it is in the series; hide this if image isn’t in the series
//if ($key >= 0) {
// add 1 so that the first image is image 1 in the series, not 0
//print ‘<div class=”series”>’ . ($key + 1) . ‘ of ‘ . $thumbs_size . “</div>nn”;
// caption (optional)
if (file_exists(“$captions_dir/$i.$cext”)) {
print ‘<br><div class=”caption”>’ . “n”;
require(“$captions_dir/$i.$cext”);
print “n</div>n”;
}
} else { // no image found
?><p><a href=”<?=$self?>”>index</a></p>
<?
imgerror(‘Sorry, that image does not exist…’);
}
?>
</div>
<!– end of image gallery “stuff” –>
</body>
</html>