コーダー。私はphpに非常に慣れていないので、私のコードは間違っている可能性があります。txt ファイルからプレーン テキストを読み込み、それを使用して Web サイトから画像を読み込みます。(それを手伝ってくれたこのフォーラムに感謝します)。現在、これらの写真のサイズを変更する際に問題が発生しています。まず第一に、最後の 2 で if ステートメントが正しいとは思いません。また、「while」の使用方法も、使用する必要があるかどうかもわかりません。
コードに目を通して、間違いがないか確認できますか? ありがとうございました。
最初の (if) セクションでは、txt ファイルのテキストを画像にしました。今、私はそれらすべての画像のサイズを変更したいと考えています。2 番目 (if) では、これらすべての画像をサイズ変更するように呼び出しようとしています。3 番目 (if) では、サイズ変更されたすべての画像を呼び出そうとしているので、コードの最後のビットでそれらをエコーできます。
<?php
$file = 'serverlist.txt';
$servers = '';
if ($handle = fopen($file, 'r')) {
while (!feof($handle)) {
$content = trim(fgets($handle));
$names = explode(' ', $content);
foreach ($names as $name) {
$servers .= '<img src="http://minecraft.net/skin/' . $name . '.png" alt="">';
}
}
fclose($handle);
} else {
}
if $file == 'serverlist.txt' {
$fullimages = explode($servers);
foreach ($fullimages as $_fullimages) {
$face = imagecreatetruecolor($width, $height);
$imgwidth = 200;
$imgheight = 200;
imagecopyresized($face, $_fullimages, 0, 0, 8, 8, $width, $height, 8, 8);
imagecopyresized($face, $_fullimages, 0, 0, 40, 8, $width, $height, 8, 8);
}
} else {
}
if $file = 'serverlist.txt' {
$displayimages = explode($_fullimages);
foreach ($displayimages as $_displayimages) {
}
} else {
}
echo $_displayimages;
?>