Ik zit met een klein probleem, ik heb een random avatar php scriptje draaien op mijn webserver die perfect werkt in IE maar niet in Firefox. Ik vroeg me af of iemand hier weet waar het probleem ligt.
Het betreft deze link: http://www.mtonissen.nl/got/avatars/image.jpg
Dit ''plaatje'' is niet meer dan een PHP scriptje dat zo gaat:
<?PHP
$dp=opendir(".");
while ($file=readdir($dp)) {
$filenames[]=$file;
}
sort($filenames);
for ($i=0; $i<count($filenames); $i++) {
if (substr($filenames[$i],0,1)!="." && $filenames[$i]!="image.jpg") {
$files[]=$filenames[$i];
}
}
$filename=$files[rand(0,count($files)-1)];
$f = fopen($filename, "r");
$contents = fread($f, filesize($filename));
fclose($f);
print($contents);
?>
(oftwel: Basically this script reads the files in the avatar dir avoiding itself (image.jpg) and "." and ".." and ".htaccess" which will also be listened.
All the images are then put in one array and then one of them is randomly choosed.
The random image file gets opened and its content is printed out. )
In dezelfde folder als de image.jpg en andere afbeeldingen(die dus gekozen worden) staat ook een .htaccess om de .jpg te parsen als een .php. Dit bestand heeft de volgende inhoud:
AddHandler application/x-httpd-php .jpg .php
Ook heb ik dit extra stukje code: Header("Content-type: image/jpeg");
Deze zorgt ervoor dat er direct gelinkt kan worden naar de .jpg er dat hij ook werkt. Maar waar voeg ik deze code in? In de .htaccess of image.jpg(PHP)
Het betreft deze link: http://www.mtonissen.nl/got/avatars/image.jpg
Dit ''plaatje'' is niet meer dan een PHP scriptje dat zo gaat:
<?PHP
$dp=opendir(".");
while ($file=readdir($dp)) {
$filenames[]=$file;
}
sort($filenames);
for ($i=0; $i<count($filenames); $i++) {
if (substr($filenames[$i],0,1)!="." && $filenames[$i]!="image.jpg") {
$files[]=$filenames[$i];
}
}
$filename=$files[rand(0,count($files)-1)];
$f = fopen($filename, "r");
$contents = fread($f, filesize($filename));
fclose($f);
print($contents);
?>
(oftwel: Basically this script reads the files in the avatar dir avoiding itself (image.jpg) and "." and ".." and ".htaccess" which will also be listened.
All the images are then put in one array and then one of them is randomly choosed.
The random image file gets opened and its content is printed out. )
In dezelfde folder als de image.jpg en andere afbeeldingen(die dus gekozen worden) staat ook een .htaccess om de .jpg te parsen als een .php. Dit bestand heeft de volgende inhoud:
AddHandler application/x-httpd-php .jpg .php
Ook heb ik dit extra stukje code: Header("Content-type: image/jpeg");
Deze zorgt ervoor dat er direct gelinkt kan worden naar de .jpg er dat hij ook werkt. Maar waar voeg ik deze code in? In de .htaccess of image.jpg(PHP)
If it aint broke, fix it till it is!