|
Posted by MZ on 04/15/07 11:23
Hello!
I have written such function...
Unfortunately images are not sorted by filename and I don`t know why.
I have such files placed in subfolder:
2005_11_17_koncert_Riverisde_w_Poznaniu_1.jpg
2005_11_17_koncert_Riverisde_w_Poznaniu_2.jpg
2005_11_17_koncert_Riverisde_w_Poznaniu_3.jpg
2005_11_17_koncert_Riverisde_w_Poznaniu_4.jpg
2005_11_17_koncert_Riverisde_w_Poznaniu_5.jpg
2005_11_17_koncert_Riverisde_w_Poznaniu_6.jpg
2006_01_22_wizyta_Panstwa_Rakowskich.jpg
2006_01_22_wizyta_u_babci_Ali.jpg
Even if I replaced the file names into
a2005_11_17_koncert_Riverisde_w_Poznaniu_1.jpg
a2005_11_17_koncert_Riverisde_w_Poznaniu_2.jpg
a2005_11_17_koncert_Riverisde_w_Poznaniu_3.jpg
a2005_11_17_koncert_Riverisde_w_Poznaniu_4.jpg
a2005_11_17_koncert_Riverisde_w_Poznaniu_5.jpg
a2005_11_17_koncert_Riverisde_w_Poznaniu_6.jpg
b2006_01_22_wizyta_Panstwa_Rakowskich.jpg
b2006_01_22_wizyta_u_babci_Ali.jpg
it still gives me the wrong order.
Can you help me fixing it?
-------------------------------------------------------------------------------
function zczytaj_zdjecia_z_folderu($sciezka)
{
error_reporting(0);
$handle=opendir($sciezka);
if ($handle=="")
{
echo "<br>";
echo "<p align=\"center\">Brak plikow na dysku <b>".$sciezka."</b></p>";
$ilosc_zdjec_w_folderze=-1;
}
else
{
$licznik=0;
while (false !== ($file = readdir($handle)))
{
if ($file <> "." && $file <> "..")
{
$licznik++;
if ( (substr(strtoupper($file),strlen($file)-4,4)==".GIF") ||
(substr(strtoupper($file),strlen($file)-4,4)==".JPG") ||
(substr(strtoupper($file),strlen($file)-4,4)==".JPEG") ||
(substr(strtoupper($file),strlen($file)-4,4)==".BMP") ||
(substr(strtoupper($file),strlen($file)-4,4)==".PNG")
)
list($width, $height, $type, $attr) = getimagesize($sciezka.$file);
$item=$width/160;
$width_new=160;
$height_new=intval($height/$item);
if ($height_new>100)
{
$item=$height/100;
$height_new=100;
$width_new=intval($width/$item);
}
//najlepiej dobrany rozmiar to height=100; width=160;
{
?>
<a href="#" OnClick="funkcja('<?=$sciezka.$file; ?>');"><img
alt="<?=$file; ?>" src="<?=$sciezka."/".$file; ?>" border="1"
height="<?=$height_new; ?>" width="<?=$width_new; ?>"></a>
<?
if ($licznik==5) { echo "<br><br>"; $licznik=0;}
error_reporting(1);
// break;
}
}
else
{
}
}
}
error_reporting(1);
return (0);
}
----------------------------------------------------------------------------------------
Navigation:
[Reply to this message]
|