<?php
// Copyright by A.Rebmann - webYourPhotos

if (isset($_REQUEST['width_min'])) { $min = $_REQUEST['width_min'] - 1 ; } else { $min = 50;  }
if (isset($_REQUEST['width_max'])) { $max = $_REQUEST['width_max'] + 1 ; } else { $max = 800; }
if (isset($_REQUEST['target'])) { $target1 = '" target="' . substr($_REQUEST['target'],0,12) ; } else { $target1 = "" ; } // Sie können beim Aufruf den Ziel frame mitübergeben: ..&target=framename
foreach(array_merge($_REQUEST,$_FILES) as $key=>$value){if(isset(${$key})){unset(${$key});}}

$data = file("../all_pictures.txt");
$anz = count($data) ;
$help = 66;
$zufall = rand(0,333) ;
$zeit = date(U) + $zufall ;
while ((($min > $w)||($max < $w))&&($help>-2)) {
$bild = explode("*",trim($data[(($zeit) % $anz )])) ;
$w = $bild[1] ;
$help-- ; $zeit = $zeit - $zufall ;}

if ($bild[1]>$max) { $bild[2] = $bild[2] * ($max-1) / $bild[1] ; $bild[1] = $max-1 ; }
$htmljs = 'document.write(\'<a href="' . $bild[3] . $target1 . '"><img src="' . $bild[0] . '" width="' . $bild[1] . '" height="' . $bild[2] . '" title="' . $bild[4] . '" border="0"></a>\') ;' ;

echo $htmljs ;

?>