This commit has been accessed 545 times via Git panel.
commit d444a44393ca5985a031d7ef256732c751d63232
tree c6317a46bf5ba2b51761d1ff868f45997cbb71cd
parent 7a4dead464fb20ecebee07e80fcb21431af3dd08
author Engels Antonio <engels@majcms.org> 1277488490 +0800
committer Engels Antonio <engels@majcms.org> 1277488490 +0800
Add album EXIF info support
diff --git a/album.php b/album.php
index fe95aad..89d8b71 100644
--- a/album.php
+++ b/album.php
@@ -13,8 +13,8 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP
if (get_magic_quotes_gpc()) {
function stripslashes_array($data) {
if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
+ foreach ($data as $album_image_exif_key => $album_image_exif_valueue) {
+ $data[$album_image_exif_key] = stripslashes_array($album_image_exif_valueue);
}
return $data;
}
@@ -149,7 +149,7 @@ body {
background-color: #FFFFFF;
}
-p {
+p,td {
font-size: 11px;
}
@@ -203,11 +203,13 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
fclose($fp_image_views_txt);
}
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc>";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#ffffff\"><tr><td valign=\"top\">";
- echo "<tr bgcolor=#ffffff><td><p align=center><b>{$_REQUEST['show']}</b></p></td><td><p align=center>";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\">";
- $album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
+ echo "<tr bgcolor=\"#ffffff\"><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];
$album_image_height = $album_image_size[1];
@@ -215,7 +217,7 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
$size = filesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
$size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
- echo "</p></td><td><p align=center>$size_string</p></td><td><p align=center>";
+ echo "</td><td align=\"center\">$size_string</td><td align=\"center\">";
$album_image_views = file_get_contents("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt");
echo "$album_image_views view";
@@ -224,9 +226,9 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "s";
}
- echo "</p></td></tr>";
+ echo "</td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4>";
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"4\">";
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)) {
@@ -272,132 +274,163 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
}
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- echo "<tr bgcolor=#ffffff><td colspan=4 width=$album_image_width><p>";
+ echo "<tr bgcolor=#ffffff><td colspan=4 width=$album_image_width>";
$caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
echo $caption_get;
- echo "</p></td></tr>";
+ echo "</td></tr>";
}
}
echo "</table>";
-}
+ echo "</td><td rowspan=\"3\" width=\"10\"></td><td valign=\"top\" rowspan=\"3\">";
+
+ //if(isset($album_image_info['APP13'])) {
+ //
+ // $album_image_iptc = iptcparse($album_image_info['APP13']);
+ //
+ // foreach (array_keys($album_image_iptc) as $album_image_iptc_array) {
+ //
+ // $c = count($album_image_iptc[$album_image_iptc_array]);
+ //
+ // for ($i=0; $i <$c; $i++) {
+ // echo $album_image_iptc_array . ' = ' . $album_image_iptc[$album_image_iptc_array][$i] .'<br>';
+ // }
+ // }
+ //}
+
+ $album_image_exif = exif_read_data("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}", 0, true);
+
+ foreach ($album_image_exif as $album_image_exif_key => $album_image_exif_section) {
+
+ foreach ($album_image_exif_section as $album_image_exif_name => $album_image_exif_value) {
+
+ $album_image_exif_value = strip_tags($album_image_exif_value);
+
+ if ((($album_image_exif_key == "EXIF") or ($album_image_exif_key == "IFD0")) and !empty($album_image_exif_value) and ($album_image_exif_name != "MakerNote") and ($album_image_exif_name != "ComponentsConfiguration") and ($album_image_exif_name != "FileSource") and ($album_image_exif_name != "SceneType") and ($album_image_exif_name != "CFAPattern")) {
+ echo "<nobr>$album_image_exif_name: $album_image_exif_value</nobr><br>";
+ }
+ }
+ }
-echo "<p></p>";
+ 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={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
-if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
- while (($thumbnail_album = readdir($dh_album)) !== false) {
- if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
- $current_thumbnail = "images/{$_REQUEST['entry']}/thumbnails/$thumbnail_album";
- $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
- $parent_image = "images/{$_REQUEST['entry']}/album/$parent_image";
- if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
- unlink($current_thumbnail);
+ if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
+ if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
+ while (($thumbnail_album = readdir($dh_album)) !== false) {
+ if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
+ $current_thumbnail = "images/{$_REQUEST['entry']}/thumbnails/$thumbnail_album";
+ $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
+ $parent_image = "images/{$_REQUEST['entry']}/album/$parent_image";
+ if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
+ unlink($current_thumbnail);
+ }
}
}
}
}
-}
-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;
+ 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);
}
- closedir($dh_album);
- }
- sort($sort_album);
- reset($sort_album);
- $count_album_entry = count($sort_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 ($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_width > $max_width) || ($current_height > $max_height)) {
-
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
+ else {
+ $sizefactor = (double) ($max_width / $current_width) ;
+ }
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+ }
else {
- $sizefactor = (double) ($max_width / $current_width) ;
+ $new_width = $current_width;
+ $new_height = $current_height;
}
-
- $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")) {
- $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;
+ 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);
}
- imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
+ echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- mkdir("images/{$_REQUEST['entry']}/thumbnails");
+ 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";
}
- imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
-
- imagedestroy($work_thumb);
- imagedestroy($work_image);
+ 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 "<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";
- }
+ 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>";
- 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></table>";
}
-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>";
-
?>
diff --git a/rel.txt b/rel.txt
index 5379875..34f5e8c 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201006180340
+201006260136
tree c6317a46bf5ba2b51761d1ff868f45997cbb71cd
parent 7a4dead464fb20ecebee07e80fcb21431af3dd08
author Engels Antonio <engels@majcms.org> 1277488490 +0800
committer Engels Antonio <engels@majcms.org> 1277488490 +0800
Add album EXIF info support
diff --git a/album.php b/album.php
index fe95aad..89d8b71 100644
--- a/album.php
+++ b/album.php
@@ -13,8 +13,8 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP
if (get_magic_quotes_gpc()) {
function stripslashes_array($data) {
if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
+ foreach ($data as $album_image_exif_key => $album_image_exif_valueue) {
+ $data[$album_image_exif_key] = stripslashes_array($album_image_exif_valueue);
}
return $data;
}
@@ -149,7 +149,7 @@ body {
background-color: #FFFFFF;
}
-p {
+p,td {
font-size: 11px;
}
@@ -203,11 +203,13 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
fclose($fp_image_views_txt);
}
- echo "<table cellspacing=1 cellpadding=2 border=0 bgcolor=#cccccc>";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#ffffff\"><tr><td valign=\"top\">";
- echo "<tr bgcolor=#ffffff><td><p align=center><b>{$_REQUEST['show']}</b></p></td><td><p align=center>";
+ echo "<table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bgcolor=\"#cccccc\">";
- $album_image_size = getimagesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
+ echo "<tr bgcolor=\"#ffffff\"><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];
$album_image_height = $album_image_size[1];
@@ -215,7 +217,7 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
$size = filesize("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}");
$size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
- echo "</p></td><td><p align=center>$size_string</p></td><td><p align=center>";
+ echo "</td><td align=\"center\">$size_string</td><td align=\"center\">";
$album_image_views = file_get_contents("data/items/{$_REQUEST['entry']}/album/views/{$_REQUEST['show']}.txt");
echo "$album_image_views view";
@@ -224,9 +226,9 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
echo "s";
}
- echo "</p></td></tr>";
+ echo "</td></tr>";
- echo "<tr bgcolor=#ffffff><td colspan=4>";
+ echo "<tr bgcolor=\"#ffffff\"><td colspan=\"4\">";
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)) {
@@ -272,132 +274,163 @@ if (file_exists("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}")) {
}
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
if (file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt")) {
- echo "<tr bgcolor=#ffffff><td colspan=4 width=$album_image_width><p>";
+ echo "<tr bgcolor=#ffffff><td colspan=4 width=$album_image_width>";
$caption_get = file_get_contents("data/items/{$_REQUEST['entry']}/album/captions/{$_REQUEST['show']}.txt");
echo $caption_get;
- echo "</p></td></tr>";
+ echo "</td></tr>";
}
}
echo "</table>";
-}
+ echo "</td><td rowspan=\"3\" width=\"10\"></td><td valign=\"top\" rowspan=\"3\">";
+
+ //if(isset($album_image_info['APP13'])) {
+ //
+ // $album_image_iptc = iptcparse($album_image_info['APP13']);
+ //
+ // foreach (array_keys($album_image_iptc) as $album_image_iptc_array) {
+ //
+ // $c = count($album_image_iptc[$album_image_iptc_array]);
+ //
+ // for ($i=0; $i <$c; $i++) {
+ // echo $album_image_iptc_array . ' = ' . $album_image_iptc[$album_image_iptc_array][$i] .'<br>';
+ // }
+ // }
+ //}
+
+ $album_image_exif = exif_read_data("images/{$_REQUEST['entry']}/album/{$_REQUEST['show']}", 0, true);
+
+ foreach ($album_image_exif as $album_image_exif_key => $album_image_exif_section) {
+
+ foreach ($album_image_exif_section as $album_image_exif_name => $album_image_exif_value) {
+
+ $album_image_exif_value = strip_tags($album_image_exif_value);
+
+ if ((($album_image_exif_key == "EXIF") or ($album_image_exif_key == "IFD0")) and !empty($album_image_exif_value) and ($album_image_exif_name != "MakerNote") and ($album_image_exif_name != "ComponentsConfiguration") and ($album_image_exif_name != "FileSource") and ($album_image_exif_name != "SceneType") and ($album_image_exif_name != "CFAPattern")) {
+ echo "<nobr>$album_image_exif_name: $album_image_exif_value</nobr><br>";
+ }
+ }
+ }
-echo "<p></p>";
+ 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={$album_image_width}><p><b>Album</b></p></td></tr><tr bgcolor=#ffffff><td width={$album_image_width}>";
-if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
- while (($thumbnail_album = readdir($dh_album)) !== false) {
- if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
- $current_thumbnail = "images/{$_REQUEST['entry']}/thumbnails/$thumbnail_album";
- $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
- $parent_image = "images/{$_REQUEST['entry']}/album/$parent_image";
- if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
- unlink($current_thumbnail);
+ if (file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
+ if ($dh_album = opendir("images/{$_REQUEST['entry']}/thumbnails")) {
+ while (($thumbnail_album = readdir($dh_album)) !== false) {
+ if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*",$thumbnail_album)) {
+ $current_thumbnail = "images/{$_REQUEST['entry']}/thumbnails/$thumbnail_album";
+ $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
+ $parent_image = "images/{$_REQUEST['entry']}/album/$parent_image";
+ if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
+ unlink($current_thumbnail);
+ }
}
}
}
}
-}
-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;
+ 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);
}
- closedir($dh_album);
- }
- sort($sort_album);
- reset($sort_album);
- $count_album_entry = count($sort_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 ($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_width > $max_width) || ($current_height > $max_height)) {
-
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
+ else {
+ $sizefactor = (double) ($max_width / $current_width) ;
+ }
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+ }
else {
- $sizefactor = (double) ($max_width / $current_width) ;
+ $new_width = $current_width;
+ $new_height = $current_height;
}
-
- $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")) {
- $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;
+ 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);
}
- imagecopyresampled($work_thumb,$work_image,0,0,0,0,$new_width,$new_height,$current_width,$current_height);
+ echo "<a href=\"album.php?entry={$_REQUEST['entry']}&show=$album_entry\">";
- if (!file_exists("images/{$_REQUEST['entry']}/thumbnails")) {
- mkdir("images/{$_REQUEST['entry']}/thumbnails");
+ 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";
}
- imagejpeg($work_thumb,"images/{$_REQUEST['entry']}/thumbnails/{$album_entry}-thumbnail.jpg",80);
-
- imagedestroy($work_thumb);
- imagedestroy($work_image);
+ 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 "<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";
- }
+ 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>";
- 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></table>";
}
-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>";
-
?>
diff --git a/rel.txt b/rel.txt
index 5379875..34f5e8c 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201006180340
+201006260136