我有这个奇怪的行为不端的脚本。它在 Windows 7 (Easy PHP 12.0, PHP 5.4.4, Apache 2.4.2) 中运行正常,但在 LinuxMint 13 (Apache 2.2.22 Ubuntu) 中不起作用我知道 linux 区分大小写,所以我仔细检查了文件路径,我用过error_reporting(E_ALL)
,但没有错误。
<?php
$DumpHere='../Img/Gallery/DumpHere/';
$ThumbsFolder='../Img/Gallery/Thumbs/';
$PreviewFolder='../Img/Gallery/Preview/';
$Files=array_diff(scandir($DumpHere), array('..', '.'));
echo '<div id="FileList" >';
echo "<ul>";
foreach ($Files as $key => $list) {
echo ("<li>".$list."</li>");
}
echo "</ul>";
echo "</div> <!-- closes FileList -->";
echo '<div id="WorkArea"><form action="insertGalleryTitles.php" method="post"><ul>';
foreach ($Files as $key => $Processed) {
$filename = $DumpHere.$Processed;
// Get new dimensions
list($width, $height) = getimagesize($filename);
$ratio = $width/$height;
$outputHeight = 500*$ratio;
// Resample thumbnail
$image_p = imagecreatetruecolor(70, 70);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, 70, 70, $width, $height);
// Output Thumbnail
imagejpeg($image_p, $ThumbsFolder.'thumb_'.$Processed, 100);
// Resample preview
$image_p = imagecreatetruecolor(500, $outputHeight);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, 500, $outputHeight, $width, $height);
// Output Preview
imagejpeg($image_p, $PreviewFolder.'preview_'.$Processed, 100);
echo '<li><img src="'.$ThumbsFolder.'thumb_'.$Processed.'">';
echo '<input type="text" name="title['.$Processed.']" value="vyplň popisek">';
}
echo "</li>";
echo '</ul><input type="submit" ></form></div>';
?>