This commit has been accessed 296 times via Git panel.
commit 2d702a44ad667d898a2159e49d5b18b091e26c8d
tree ca65b737e8c862c064d0520aeee32e13534f5433
parent fc0995adbb2cee77386358a4816ec4d4d06430ae
author Engels Antonio <engels@majcms.org> 1279914963 +0800
committer Engels Antonio <engels@majcms.org> 1279914963 +0800
Add album next and previous images
Add simple javaScript album image preloading
diff --git a/album.php b/album.php
index 89d8b71..3cc3539 100644
--- a/album.php
+++ b/album.php
@@ -187,6 +187,34 @@ a:active {
<?php
+if (file_exists("images/{$_REQUEST['entry']}/album")) {
+ if ($dh_album = opendir("images/{$_REQUEST['entry']}/album")) {
+ while (($entry_album = readdir($dh_album)) !== false) {
+ if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+ $sort_album[] = $entry_album;
+ }
+ }
+ closedir($dh_album);
+ }
+
+ sort($sort_album);
+ reset($sort_album);
+}
+
+$key_view = array_search($_REQUEST['show'],$sort_album);
+
+$key_prev = $key_view - 1;
+$key_next = $key_view + 1;
+
+$show_prev = $sort_album[$key_prev];
+$show_next = $sort_album[$key_next];
+
+$count_album_entry = count($sort_album);
+
+$album_image_colspan = 4;
+
+// echo "$count_album_entry -> $key_prev | $key_view | $key_next";
+
if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
if (!file_exists("data/items/{$_REQUEST['entry']}/album/views")) {
@@ -205,9 +233,16 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#ffffff\"><tr><td valign=\"top\">";
- echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\">";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\"><tr bgcolor=\"#ffffff\">";
+
+ if ($key_prev >= 0) {
- echo "<tr bgcolor=\"#ffffff\"><td align=\"center\"><b>{$_REQUEST['show']}</b></td><td align=\"center\">";
+ $album_image_colspan = $album_image_colspan + 1;
+
+ echo "<td align=\"left\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_prev\"><img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
+ }
+
+ echo "<td align=\"center\"><b>{$_REQUEST['show']}</b></td><td align=\"center\">";
$album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}",$album_image_info);
$album_image_width = $album_image_size[0];
@@ -226,9 +261,18 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "s";
}
- echo "</td></tr>";
+ echo "</td>";
- echo "<tr bgcolor=\"#ffffff\"><td colspan=\"4\">";
+ if ($key_next < $count_album_entry) {
+
+ $album_image_colspan = $album_image_colspan + 1;
+
+ echo "<td align=\"right\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_next\"><img src=\"images/widget.move.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
+ }
+
+ echo "</tr>";
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"$album_image_colspan\" align=\"center\">";
echo "<img src=images/{$_REQUEST['entry']}/album/{$_REQUEST['show']} width=$album_image_width height=$album_image_height border=0>";
echo "</td></tr>";
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -236,20 +280,20 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=delete>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=submit class=input value=\"click here to delete image\"></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to delete image\"></td></tr>";
echo "</form>";
echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=rename>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=submit class=input value=\"click here to rename image\"></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to rename image\"></td></tr>";
echo "</form>";
echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=caption>";
- echo "<tr bgcolor=#ffffff><td colspan=4>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\">";
echo "<textarea class=input name=caption rows=3>";
if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
$caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
@@ -315,7 +359,7 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "</td></tr><tr><td height=\"10\"></td></tr><tr><td valign=\"top\">";
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
+ echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width=100%><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width=100%>";
if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
@@ -332,105 +376,106 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
}
}
-
- if (file_exists("images/{$_REQUEST['entry']}/album")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/album")) {
- while (($entry_album = readdir($dh_album)) !== false) {
- if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
- $sort_album[] = $entry_album;
- }
- }
- closedir($dh_album);
- }
-
- sort($sort_album);
- reset($sort_album);
- $count_album_entry = count($sort_album);
-
- if ($count_album_entry < 1) {
- rmdirr("images/{$_REQUEST['entry']}/album");
- rmdirr("images/{$_REQUEST['entry']}/thumbnails");
- }
- else {
- foreach($sort_album as $album_entry) {
- $current_image = "images/{$_REQUEST['entry']}/album/$album_entry";
- $current_image_size = getimagesize($current_image);
- $current_width = $current_image_size[0];
- $current_height = $current_image_size[1];
- $max_width = 98;
- $max_height = 73;
-
- if (($current_width > $max_width) || ($current_height > $max_height)) {
-
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
- else {
- $sizefactor = (double) ($max_width / $current_width) ;
- }
+ if ($count_album_entry < 1) {
+ rmdirr("images/{$_REQUEST['entry']}/album");
+ rmdirr("images/{$_REQUEST['entry']}/thumbnails");
+ }
+ else {
+ foreach($sort_album as $album_entry) {
+ $current_image = "images/{$_REQUEST['entry']}/album/$album_entry";
+ $current_image_size = getimagesize($current_image);
+ $current_width = $current_image_size[0];
+ $current_height = $current_image_size[1];
+ $max_width = 98;
+ $max_height = 73;
- $new_width = (int) ($current_width * $sizefactor);
- $new_height = (int) ($current_height * $sizefactor);
- }
+ if (($current_width > $max_width) || ($current_height > $max_height)) {
+
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
else {
- $new_width = $current_width;
- $new_height = $current_height;
+ $sizefactor = (double) ($max_width / $current_width) ;
}
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+ }
+ else {
+ $new_width = $current_width;
+ $new_height = $current_height;
+ }
+
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
-
- $work_thumb = imagecreatetruecolor($new_width,$new_height);
- $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
-
- switch($get_mimetype) {
- case "image/jpg":
- case "image/jpeg":
- $work_image = imagecreatefromjpeg($current_image);
- break;
- case "image/gif":
- $work_image = imagecreatefromgif($current_image);
- break;
- case "image/png":
- $work_image = imagecreatefrompng($current_image);
- break;
- }
-
- imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
-
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- mkdir("images/{$_REQUEST['entry']}/thumbnails");
- }
-
- imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
-
- imagedestroy($work_thumb);
- imagedestroy($work_image);
+ $work_thumb = imagecreatetruecolor($new_width,$new_height);
+ $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
+
+ switch($get_mimetype) {
+ case "image/jpg":
+ case "image/jpeg":
+ $work_image = imagecreatefromjpeg($current_image);
+ break;
+ case "image/gif":
+ $work_image = imagecreatefromgif($current_image);
+ break;
+ case "image/png":
+ $work_image = imagecreatefrompng($current_image);
+ break;
}
- echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
+ imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- echo "<img src=\"images/{$_REQUEST['entry']}/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- }
- else {
- echo "<img src=\"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
+ mkdir("images/{$_REQUEST['entry']}/thumbnails");
}
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
- echo ' alt="';
- $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
- $img_alt = strip_tags($img_alt);
- echo $img_alt;
- echo '"';
- }
- echo "></a>";
+ imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
+
+ imagedestroy($work_thumb);
+ imagedestroy($work_image);
}
- }
- }
+
+ echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
+
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
+ echo "<img src=\"images/{$_REQUEST['entry']}/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+ else {
+ echo "<img src=\"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+
+ if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
+ echo ' alt="';
+ $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
+ $img_alt = strip_tags($img_alt);
+ echo $img_alt;
+ echo '"';
+ }
+ echo "></a>";
+ }
+ }
echo "</td></tr><form method=post action=index.php?entry={$_REQUEST['entry']}&show=album><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the main entry\"></td></tr></form><form method=post action=index.php><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the index page\"></td></tr></form></table>";
echo "</td></tr></table>";
}
+if (isset($_SERVER['HTTPS'])) {
+ $maj_proto = "https://";
+}
+else {
+ $maj_proto = "http://";
+}
+
+$maj_url = $maj_proto . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+
+if ($key_prev >= 0) {
+
+ echo "\n\n<script>\n\tvar img_prev = new Image();\n\timg_prev.src = \"$maj_url/images/{$_REQUEST['entry']}/album/$show_prev\";\n</script>";
+}
+
+if ($key_next < $count_album_entry) {
+ echo "\n\n<script>\n\tvar img_next = new Image();\n\timg_next.src = \"$maj_url/images/{$_REQUEST['entry']}/album/$show_next\";\n</script>";}
+
?>
diff --git a/rel.txt b/rel.txt
index b6285cd..46a6895 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201007190908
+201007240339
tree ca65b737e8c862c064d0520aeee32e13534f5433
parent fc0995adbb2cee77386358a4816ec4d4d06430ae
author Engels Antonio <engels@majcms.org> 1279914963 +0800
committer Engels Antonio <engels@majcms.org> 1279914963 +0800
Add album next and previous images
Add simple javaScript album image preloading
diff --git a/album.php b/album.php
index 89d8b71..3cc3539 100644
--- a/album.php
+++ b/album.php
@@ -187,6 +187,34 @@ a:active {
<?php
+if (file_exists("images/{$_REQUEST['entry']}/album")) {
+ if ($dh_album = opendir("images/{$_REQUEST['entry']}/album")) {
+ while (($entry_album = readdir($dh_album)) !== false) {
+ if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+ $sort_album[] = $entry_album;
+ }
+ }
+ closedir($dh_album);
+ }
+
+ sort($sort_album);
+ reset($sort_album);
+}
+
+$key_view = array_search($_REQUEST['show'],$sort_album);
+
+$key_prev = $key_view - 1;
+$key_next = $key_view + 1;
+
+$show_prev = $sort_album[$key_prev];
+$show_next = $sort_album[$key_next];
+
+$count_album_entry = count($sort_album);
+
+$album_image_colspan = 4;
+
+// echo "$count_album_entry -> $key_prev | $key_view | $key_next";
+
if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
if (!file_exists("data/items/{$_REQUEST['entry']}/album/views")) {
@@ -205,9 +233,16 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#ffffff\"><tr><td valign=\"top\">";
- echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\">";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\"><tr bgcolor=\"#ffffff\">";
+
+ if ($key_prev >= 0) {
- echo "<tr bgcolor=\"#ffffff\"><td align=\"center\"><b>{$_REQUEST['show']}</b></td><td align=\"center\">";
+ $album_image_colspan = $album_image_colspan + 1;
+
+ echo "<td align=\"left\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_prev\"><img src=\"images/widget.back.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
+ }
+
+ echo "<td align=\"center\"><b>{$_REQUEST['show']}</b></td><td align=\"center\">";
$album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}",$album_image_info);
$album_image_width = $album_image_size[0];
@@ -226,9 +261,18 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "s";
}
- echo "</td></tr>";
+ echo "</td>";
- echo "<tr bgcolor=\"#ffffff\"><td colspan=\"4\">";
+ if ($key_next < $count_album_entry) {
+
+ $album_image_colspan = $album_image_colspan + 1;
+
+ echo "<td align=\"right\" width=\"11\"><a href=\"album.php?entry={$_REQUEST['entry']}&show=$show_next\"><img src=\"images/widget.move.png\" border=\"0\" width=\"11\" height=\"11\"></a></td>";
+ }
+
+ echo "</tr>";
+
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"$album_image_colspan\" align=\"center\">";
echo "<img src=images/{$_REQUEST['entry']}/album/{$_REQUEST['show']} width=$album_image_width height=$album_image_height border=0>";
echo "</td></tr>";
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -236,20 +280,20 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=delete>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=submit class=input value=\"click here to delete image\"></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to delete image\"></td></tr>";
echo "</form>";
echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=rename>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4><input type=submit class=input value=\"click here to rename image\"></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=text autocomplete=off class=input name=filename value={$_REQUEST['show']}></td></tr>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\"><input type=submit class=input value=\"click here to rename image\"></td></tr>";
echo "</form>";
echo "<form enctype=\"multipart\/form-data\" action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">";
echo "<input type=hidden name=entry value={$_REQUEST['entry']}>";
echo "<input type=hidden name=show value={$_REQUEST['show']}>";
echo "<input type=hidden name=edit value=caption>";
- echo "<tr bgcolor=#ffffff><td colspan=4>";
+ echo "<tr bgcolor=#ffffff><td colspan=\"$album_image_colspan\">";
echo "<textarea class=input name=caption rows=3>";
if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
$caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
@@ -315,7 +359,7 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "</td></tr><tr><td height=\"10\"></td></tr><tr><td valign=\"top\">";
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
+ echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc><tr bgcolor=#ffffff><td width=100%><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width=100%>";
if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
@@ -332,105 +376,106 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
}
}
-
- if (file_exists("images/{$_REQUEST['entry']}/album")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/album")) {
- while (($entry_album = readdir($dh_album)) !== false) {
- if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
- $sort_album[] = $entry_album;
- }
- }
- closedir($dh_album);
- }
-
- sort($sort_album);
- reset($sort_album);
- $count_album_entry = count($sort_album);
-
- if ($count_album_entry < 1) {
- rmdirr("images/{$_REQUEST['entry']}/album");
- rmdirr("images/{$_REQUEST['entry']}/thumbnails");
- }
- else {
- foreach($sort_album as $album_entry) {
- $current_image = "images/{$_REQUEST['entry']}/album/$album_entry";
- $current_image_size = getimagesize($current_image);
- $current_width = $current_image_size[0];
- $current_height = $current_image_size[1];
- $max_width = 98;
- $max_height = 73;
-
- if (($current_width > $max_width) || ($current_height > $max_height)) {
-
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
- else {
- $sizefactor = (double) ($max_width / $current_width) ;
- }
+ if ($count_album_entry < 1) {
+ rmdirr("images/{$_REQUEST['entry']}/album");
+ rmdirr("images/{$_REQUEST['entry']}/thumbnails");
+ }
+ else {
+ foreach($sort_album as $album_entry) {
+ $current_image = "images/{$_REQUEST['entry']}/album/$album_entry";
+ $current_image_size = getimagesize($current_image);
+ $current_width = $current_image_size[0];
+ $current_height = $current_image_size[1];
+ $max_width = 98;
+ $max_height = 73;
- $new_width = (int) ($current_width * $sizefactor);
- $new_height = (int) ($current_height * $sizefactor);
- }
+ if (($current_width > $max_width) || ($current_height > $max_height)) {
+
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
else {
- $new_width = $current_width;
- $new_height = $current_height;
+ $sizefactor = (double) ($max_width / $current_width) ;
}
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+ }
+ else {
+ $new_width = $current_width;
+ $new_height = $current_height;
+ }
+
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
-
- $work_thumb = imagecreatetruecolor($new_width,$new_height);
- $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
-
- switch($get_mimetype) {
- case "image/jpg":
- case "image/jpeg":
- $work_image = imagecreatefromjpeg($current_image);
- break;
- case "image/gif":
- $work_image = imagecreatefromgif($current_image);
- break;
- case "image/png":
- $work_image = imagecreatefrompng($current_image);
- break;
- }
-
- imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
-
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- mkdir("images/{$_REQUEST['entry']}/thumbnails");
- }
-
- imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
-
- imagedestroy($work_thumb);
- imagedestroy($work_image);
+ $work_thumb = imagecreatetruecolor($new_width,$new_height);
+ $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
+
+ switch($get_mimetype) {
+ case "image/jpg":
+ case "image/jpeg":
+ $work_image = imagecreatefromjpeg($current_image);
+ break;
+ case "image/gif":
+ $work_image = imagecreatefromgif($current_image);
+ break;
+ case "image/png":
+ $work_image = imagecreatefrompng($current_image);
+ break;
}
- echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
+ imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
- echo "<img src=\"images/{$_REQUEST['entry']}/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- }
- else {
- echo "<img src=\"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
+ mkdir("images/{$_REQUEST['entry']}/thumbnails");
}
- if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
- echo ' alt="';
- $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
- $img_alt = strip_tags($img_alt);
- echo $img_alt;
- echo '"';
- }
- echo "></a>";
+ imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
+
+ imagedestroy($work_thumb);
+ imagedestroy($work_image);
}
- }
- }
+
+ echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
+
+ if (!file_exists("images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg")) {
+ echo "<img src=\"images/{$_REQUEST['entry']}/album/$album_entry\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+ else {
+ echo "<img src=\"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg\" width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+
+ if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt")) {
+ echo ' alt="';
+ $img_alt = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$album_entry}.txt");
+ $img_alt = strip_tags($img_alt);
+ echo $img_alt;
+ echo '"';
+ }
+ echo "></a>";
+ }
+ }
echo "</td></tr><form method=post action=index.php?entry={$_REQUEST['entry']}&show=album><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the main entry\"></td></tr></form><form method=post action=index.php><tr bgcolor=#ffffff><td><input class=input type=submit value=\"click here to go to the index page\"></td></tr></form></table>";
echo "</td></tr></table>";
}
+if (isset($_SERVER['HTTPS'])) {
+ $maj_proto = "https://";
+}
+else {
+ $maj_proto = "http://";
+}
+
+$maj_url = $maj_proto . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+
+if ($key_prev >= 0) {
+
+ echo "\n\n<script>\n\tvar img_prev = new Image();\n\timg_prev.src = \"$maj_url/images/{$_REQUEST['entry']}/album/$show_prev\";\n</script>";
+}
+
+if ($key_next < $count_album_entry) {
+ echo "\n\n<script>\n\tvar img_next = new Image();\n\timg_next.src = \"$maj_url/images/{$_REQUEST['entry']}/album/$show_next\";\n</script>";}
+
?>
diff --git a/rel.txt b/rel.txt
index b6285cd..46a6895 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201007190908
+201007240339