私は約30kbの(それぞれ平均して)1000個の.jpgイメージを表示しようとしています。私は最初のスクリプトをお見せしましょう:ブラウザーで30kbの画像を約1000枚表示するにはどうすればいいですか?
<?php
ini_set('display_errors', 1);
// database connection files
include '../../lib/config.php';
include '../../lib/opendb.php';
set_time_limit (9999); // to increase execution time for large upload database//
// allow access to page
$showandsave = false; // choosen to view and save the images
if(isset($_POST['submit_html'])){
$showandsave = true;
}
$reportdatefrom = $_REQUEST['reportdatefrom'];
$reportdateto = $_REQUEST['reportdateto'];
// Prepare Constant Query for Master List
$qry_const = "select";
$qry_const .= " "."a.photoname";
$qry_const .= " "."from applicants a";
$qry_const .= " "."where a.date_of_admission between '$reportdatefrom' and '$reportdateto'";
$rs = mysql_query($qry_const) or die("Error Fetching List : ".mysql_error());
$gridsize = 10;
$r = 0;
echo "<table>";
while($row = mysql_fetch_assoc($rs)){
++$r;
if($r == 1 || ($r-1)%$gridsize == 0)
echo "<tr>";
echo "<td><img src='".$row['photoname']."' height='100px' width='75px'/></td>";
if($r%$gridsize == 0)
echo "</tr>";
}
echo "</table>";
?>
を画像の数が少ないの周りに20を言っている間に、エラーは発生しません、スクリプトが完全に正常に動作します。しかし、その数が200を超えると、「500 Internal Server Error」が発生しています。このような状況にどう対応するのですか?救済策を提案してください。
サムネイルを作成しますか?私が意味することは、100x75ピクセルの画像は、およそ1-3 KBで、あなたが言うサイズの1/10です。 「500 Internal Server Error」が表示される場所(HTMLファイルまたはイメージ)を教えておくと便利です。 –
しかし、それはファイルを圧縮しません、と私は思います。 @KIKO。私は元のサイズを取得したい。私の意図は元のサイズで画像を保存することです。コードが記述されているPHPファイルに "500 Internal Server Error"が表示されます。 – samlancer
あなたのコードは社内でのみ使用されるものとしますか?あなたはdepricated mysqlライブラリを使用しており、ユーザ入力を直接SQL文に入れています。これは非常に危険です。参照:SQLインジェクション。 –