Hallo,
ich habe Random Image schon 2 - 3 mal erfolgreich eingesetzt und jetzt passiert mir auf einem anderen Server, dass es kein Hintergrundbild anzeigt. Wenn ich in den Quelltext schaue, steht da folgdende Meldung:
<div id="header_right" style="background-image: url(<br />
<b>Warning</b>: getimagesize() [<a href='function.getimagesize'>function.getimagesize</a>]: URL file-access is disabled in the server configuration in <b>/homepages/.../.../htdocs/modules/randomimage/include.php</b> on line <b>61</b><br />
<br />
<b>Warning</b>: getimagesize(http://www.....de/templates/.../img/header/header_01.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: no suitable wrapper could be found in <b>/homepages/.../.../htdocs/modules/randomimage/include.php</b> on line <b>61</b><br />
http://www.....de/templates/.../img/header/header_01.jpg)">
</div>
Die include.php vom Modul Random Image sieht bei mir so aus:
<?php
/* Random image snippet
Call this nsippet with:
RandomImage ('/media','img'); for normal img tag or
RandomImage ('/media','bgi'); for background-image
in your template
*/
function RandomImage($dir,$type) {
//read folder and get the picture names
$folder=opendir(WB_PATH.$dir.'/.');
while ($file = readdir($folder))
$names[count($names)] = $file;
closedir($folder);
//remove any non-images from array
$tempvar=0;
for ($i=0;$names[$i];$i++){
$ext=strtolower(substr($names[$i],-4));
if ($ext==".jpg"||$ext==".gif"||$ext==".png"){$names1[$tempvar]=$names[$i];$tempvar++;}
}
//random
srand ((double) microtime() * 10000000);
$rand_keys = array_rand ($names1, 2);
//random image from array
$image=$names1[$rand_keys[0]];
//image dimensions
$dimensions = GetImageSize(WB_URL.$dir.'/'.$image);
// "normal" image or background ?
switch ($type) {
case "img" : echo '<img src="'.WB_URL.$dir.'/'.$image.'" '.$dimensions[3].'>';
break;
case "bgi" : echo WB_URL.$dir.'/'.$image;
break;
default : echo '<img src="'.WB_URL.$dir.'/'.$image.'" '.$dimensions[3].'>';
}
}
?>
Kann mir jemand sagen, wie ich dieses Problem beheben kann?