&'バグ修正
* Ver 2.00 2004-09-18 1) rollスライドショー追加
* 2) アルバム管理用xmlファイルフォーマットの変更
* Ver 3.00 2005-03-21 DB使用方式に変更
*
* Copyright (C) 2003-2005 Shingo.Ishizumi All Right Reserved
*/
$mid_file = array("null",
"midi/yukiyama.mid",
"midi/tabizi.mid",
"midi/koujyou.mid",
"midi/oborotukiyo.mid",
"midi/ryosyuu.mid",
"midi/yuyake.mid",
"midi/feeling-sh.mid",
"midi/kondoru.mid");
$mid_titl = array("なし",
"雪山賛歌",
"旅路",
"荒城の月 ",
"朧月夜",
"旅愁",
"夕焼けこやけ",
"feeling",
"コンドルが飛んでいく");
$category_titl = array("山",
"沢",
"海",
"湖",
"空",
"星 ",
"花",
"木",
"祭り",
"動物",
"人物",
"建物",
"ヌード",
"その他");
$mode = $_GET['mode'];
pg_connect($connect_string);
switch ($mode) {
case "img": /* 画像入力画面 */
break;
case "data": /* データ入力画面 */
header("Content-Type:text/html\n");
print("\n");
print("
\n");
print("\n");
print("\n");
print("スライドショーの作成 データ入力\n");
print("\n");
printf("\n");
// ディレクトリ名を作成
$fp2 = fopen("data/lock1.loc", "w");
flock($fp2, LOCK_EX);
$fp1 = fopen("data/count.txt", "r");
if ($fp1 == false) {
printf("
\n");
printf("ファイル(count.txt)の読み込みに失敗しました。もう一度お試し下さい。
\n");
printf("\n");
printf("\n");
printf("\n");
return;
}
else {
$buffer = fgets($fp1, 128);
$tmp1 = explode(" ", $buffer);
fclose($fp1);
$access = $tmp1[0];
$count = $tmp1[1];
$slide = $tmp1[2];
$comp = $tmp1[3];
}
$count++;
$dir = sprintf("data/%04d", $count);
$fp1 = fopen("data/count.txt", "w");
fwrite($fp1, "$access $count $slide $comp");
fclose($fp1);
mkdir($dir);
chmod ($dir, 0777);
flock($fp2, LOCK_UN);
fclose($fp2);
$file_no = 0;
for ($i = 0; $i < 8; $i++) {
if ($img[$i] != "") {
$sz = getimagesize($img[$i]);
$nm = explode(".", $img_name[$i]);
switch ($img_type[$i]) {
case "image/pjpeg":
case "image/jpeg":
case "image/jpg":
$wid[$file_no] = $sz[0];
$hig[$file_no] = $sz[1];
$txt[$file_no] = $nm[0];
$file_no++;
$img_file = sprintf("%s/%03d.jpg", $dir, $file_no);
$rc = copy($img[$i], $img_file);
chmod ($img_file, 0666);
break;
case "image/gif":
$wid[$file_no] = $sz[0];
$hig[$file_no] = $sz[1];
$txt[$file_no] = $nm[0];
$file_no++;
$src_file = sprintf("%s.gif", $img[$i]);
$rc = copy($img[$i], $src_file);
$img_file = sprintf("%s/%03d.jpg", $dir, $file_no);
$convert_cmd=sprintf("/usr/local/bin/convert %s %s", $src_file, $img_file);
system($convert_cmd);
chmod ($img_file, 0666);
$rc = unlink($src_file);
break;
case "image/x-png":
$wid[$file_no] = $sz[0];
$hig[$file_no] = $sz[1];
$txt[$file_no] = $nm[0];
$file_no++;
$src_file = sprintf("%s.png", $img[$i]);
$rc = copy($img[$i], $src_file);
$img_file = sprintf("%s/%03d.jpg", $dir, $file_no);
$convert_cmd=sprintf("/usr/local/bin/convert %s %s", $src_file, $img_file);
system($convert_cmd);
chmod ($img_file, 0666);
$rc = unlink($src_file);
break;
default:
break;
}
}
}
if ($file_no == 0) {
printf("
\n");
printf("有効なファイルがありません。もう一度jpgファイルをアップロードしてください。
\n");
printf("\n");
}
else {
for ($i = 0; $i < $file_no; $i++) {
$img_file = sprintf("%s/%03d.jpg", $dir, $i+1);
/*** 2005-03-05 ***/
if (($wid[$i] > 800) || ($hig[$i] > 800)) {
// 800 * 800
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 800x800 %s %s", $img_file, $img_file);
system($convert_cmd);
chmod ($img_file, 0666);
}
/******************/
// 100 * 100
$imgs_file = sprintf("%s/%03ds.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 100x100 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
// 50 * 50
$imgs_file = sprintf("%s/%03d-0.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 50x50 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
/*** 2004-08-11 ***
// 116 * 156
$imgs_file = sprintf("%s/%03d-1.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 116x156 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
// 128 * 156
$imgs_file = sprintf("%s/%03d-2.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 128x156 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
// 172 * 194
$imgs_file = sprintf("%s/%03d-3.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 172x194 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
// 236 * 264
$imgs_file = sprintf("%s/%03d-4.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 236x264 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
// 236 * 316
$imgs_file = sprintf("%s/%03d-5.jpg", $dir, $i+1);
$convert_cmd=sprintf("/usr/local/bin/convert -geometry 236x316 %s %s", $img_file, $imgs_file);
system($convert_cmd);
chmod ($imgs_file, 0666);
********************/
}
printf("\n");
printf("
\n");
printf("
\n");
}
print("\n");
print("\n");
printf("