godyn Posted August 4, 2009 Share Posted August 4, 2009 Hello folks, After some experimenting I finally got the php working for tiltviewer flash gallery to load the pictures via php instad via xml file. Only I have some other things I want solved. I would like that the script only shows pictures that begin with photo' or 'picture' and between sizes.(kb) example: IF afbeelding begint met 'picture' or 'photo' AND afbeelding < 200kb AND >20Kb THEN 'toon de foto' (dus scriptje uitvoeren' ELSE niets (of niet tonen) this is the script, I would be in heaven if s.b. would help me out with this. I also would like the images to be random (I think now he follow the directory (from the array?) <?php function GetDirArray($folder) { $handle=opendir($folder); while ($file=readdir($handle)) { if ($file!="." && $file!="..") { $ret[count($ret)]=$file; } } closedir($handle); sort($ret); return $ret; } $gallery=GetDirArray('../media/uploads'); echo '<?xml version="1.0" encoding="UTF-8"?>'; echo '<tiltviewergallery>'; echo '<photos>'; for ($i=0; $i<sizeof($gallery); $i++) { echo '<photo imageurl="../media/uploads/'.$gallery[$i].'"><title></title><description></description></photo>'; } echo '</photos>'; echo '</tiltviewergallery>'; ?> Link to comment https://forums.phpfreaks.com/topic/168790-tiltviewer-php/ Share on other sites More sharing options...
patrickmvi Posted August 4, 2009 Share Posted August 4, 2009 Try this? for ($i=0; $i<sizeof($gallery); $i++) { $img_size = filesize("../media/uploads/".$gallery[$i]); if((substr($gallery[$i], 0, 7) == "picture" || substr($gallery[$i], 0, 5) == "photo") && ($img_size >= 20480 && $img_size < 204800)) { echo '<photo imageurl="../media/uploads/'.$gallery[$i].'"><title></title><description></description></photo>'; } } Link to comment https://forums.phpfreaks.com/topic/168790-tiltviewer-php/#findComment-890645 Share on other sites More sharing options...
godyn Posted August 5, 2009 Author Share Posted August 5, 2009 Yes, thank you !!!!!! :-) That works great ! Link to comment https://forums.phpfreaks.com/topic/168790-tiltviewer-php/#findComment-891104 Share on other sites More sharing options...
godyn Posted August 5, 2009 Author Share Posted August 5, 2009 how can I make the directory random? Now it always show the same order. Link to comment https://forums.phpfreaks.com/topic/168790-tiltviewer-php/#findComment-891273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.