chyby:
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'obrazky/080.jpg' for writing: No such file or directory in /home/free/yw.sk/i/infinity/root/www/obrazky/index.php on line 40
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'obrazky/083.jpg' for writing: No such file or directory in /home/free/yw.sk/i/infinity/root/www/obrazky/index.php on line 40
obrazky aj vykresli...okrem spodnych(malych) sluziacich na prepinanie..
skript:
Kód:
<?
$settings["thumbsdir"]="obrazky/"; // thumbnails directory with trailing slash
$settings["imagesperpage"]=9; // must be an even number (pair numbers don't work well)
@$dirhandle=opendir('.');
while ((@$filename=readdir($dirhandle))!==false)
{
if (ereg("jpg|gif|png|JPG|GIF|PNG",$filename))
{
$files[]=$filename;
// Create thumbnail, if no thumbnail exists
if (!file_exists($settings["thumbsdir"].$filename))
{
if (ereg("jpg|JPG",$filename)) $image=imagecreatefromjpeg($filename);
elseif (ereg("gif|GIF",$filename)) $image=imagecreatefromgif($filename);
elseif (ereg("png|PNG",$filename)) $image=imagecreatefromjpeg($filename);
$width=imagesx($image); $height=imagesy($image);
$thumbw=$width/10; $thumbh=$height/10;
$image2=imagecreatetruecolor($thumbw,$thumbh);
imagecopyresampled($image2,$image,0,0,0,0,$thumbw,$thumbh,$width,$height);
if (ereg("jpg|JPG",$filename))
{
imagejpeg($image2,$settings["thumbsdir"].$filename,80);
}
elseif (ereg("gif|GIF",$filename))
{
imagegif($image2,$settings["thumbsdir"].$filename);
}
elseif (ereg("png|PNG",$filename))
{
imagepng($image2,$settings["thumbsdir"].$filename);
}
}
}
}
sort($files);
if (isset($_GET["image"])) $key=array_search($_GET["image"],$files);
else $key=0;
list($width,$height)=getimagesize($files[$key]);
echo '<img src="',$files[$key],'" width="',$width,'" height="',$height,'" alt="',$files[$key],'" /><br />';
?>
</div>
<div id="position">
<?
$totalfiles=count($files);
echo '<span>',$key+1,'/',$totalfiles,'</span>';
?>
//zdrojak patri do code (stenley)