Created
October 8, 2014 11:24
-
-
Save peace098beat/9a6230fda71b0a62e846 to your computer and use it in GitHub Desktop.
save-upfile.php | フォルダ内の画像ファイル一覧を取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********************************************************** | |
/ ディレクトリ内の情報を取得する | |
/**********************************************************/ | |
$array = scandir("./img/"); | |
// mb_convert_variables("EUC-JP", "UTF-8", $array); | |
// mb_convert_variables("UTF-8", "UTF-8", $array); | |
// 画像ファイル以外を配列から削除; | |
$i = 0; | |
while($file_name = $array[$i]){ | |
$path = "./img/".$file_name; | |
// echo "<p>".$path; | |
if(@getimagesize($path)){ | |
$i ++; | |
}else{ | |
array_splice($array, $i, 1); | |
} | |
} | |
/********************************************************** | |
/ サムネイル表示 | |
/**********************************************************/ | |
$j=0; | |
while($temp = $array[$j]) { | |
echo '<div class="section" id="mobile"><div class="w-container photo-con"><div class="w-row">'; | |
if($a=$array[$j]){ | |
echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div> | |
'; | |
} | |
if($a=$array[$j]){ | |
echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div> | |
'; | |
} | |
if($a=$array[$j]){ | |
echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div> | |
'; | |
} | |
if($a=$array[$j]){ | |
echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div> | |
'; | |
} | |
// echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div>'; | |
// echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div>'; | |
// echo '<div class="w-col w-col-3"><img class="photo-img" src=" '."./img/".$array[$j].' " alt=" '.$array[$j].' ">'.$array[$j++].'</div>'; | |
echo '</div></div></div>'; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********************************************************** | |
/ アップロードファイルの保存 | |
/**********************************************************/ | |
if( $data = $_FILES["photo"] ){ | |
move_uploaded_file( $data["tmp_name"], "./img/".date(U).$data["name"] ); | |
// move_uploaded_file( $data["tmp_name"], "./img/".$data["name"] ); | |
// echo("<img src='"."./img/".date(U).$data["name"]."' alt=''>"); | |
}else{ | |
// echo "nono"; | |
} | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: http://orange.house.fififactory.com/www/index.php"); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment