Php If/while And Or Img Resizing Error
coders. Im very new to php, so my code is prob as wrong as it gets. Im loading plain text from a txt file and useing that to load pictures from a website. (Thanks to this forum for
Solution 1:
You are asigned the values in every if
statement you should use ==
instead of single =
<?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;
?>
Post a Comment for "Php If/while And Or Img Resizing Error"