Hello.
I have a script wich makes a picture with imagecreate wich works ok.
The problem is that I also have a opendir script in the same page, but it's not printed to the screen. Only the image is shown.
How do I also get the opendir script to show on the same page ?
Below is my script :
<?php
# Creates a image
$image = ImageCreate(850, 550);
$bg_black = ImageColorAllocate($image,0,0,0);
$text_color = ImageColorAllocate($image,0,0,255);
# Allocates all the defined colors through a loop
for($i=255; $i>0; $i--) {
$bg[$i] = ImageColorAllocate($image,$i,$i,$i*255);
}
# Draws a vertical line of each color (left side)
for($y=0; $y<50; $y+=3) {
ImageLine($image, $y, $y*0, $y, $y+550, $bg[$y]*8);
}
# Draws a vertical line of each color (right side)
for($z=0; $z<50; $z+=3) {
ImageLine($image, $z+800, $z*0, $z+850, $z+100000, $bg[$z]*8);
}
$title2 = ImageString($image, $font+20, $x+352, $y+11, " D E M O ", $text_color*80);
$title = ImageString($image, $font+20, $x+350, $y+10, " D E M O ", $text_color);
# Prints out to the scren
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
$folder = ".";
$open = opendir($folder) or die ($php_errormsg);
$files = array();
while($file = readdir($open)) {
if($file=='.' or $file=='..' or ereg('cd|txt|index',$file)) { }
else {
$files[] = "$file";
}
}
closedir($open);
sort($files);
reset($files);
for($i=0; $i<count($files); $i++) {
print "- <a href=$files[$i]>".substr(ucfirst($files[$i]),0,-4)."</a><br>";
}
?>
Reguards