mikeymizrahi Posted December 7, 2006 Share Posted December 7, 2006 can someone help explain to me how i can write a php script to show a bunch of pictures on a web page-for example, i have 200 pictures in the folder "pictures"instead of me having to link each and every photo like this: <img src="/pictures/image1.jpg"> <img src="/pictures/image2.jpg>, etc, etc,what php function or script can automatically write this for me and show the pictures?thats what php does afterall, right? dynamic pages!p.s.-i did this the manual way on this page- [url=http://www.horsebackride.com/jb/photos/shpphotos/shp1.html]http://www.horsebackride.com/jb/photos/shpphotos/shp1.html[/url] and would like to learn the new way to save me a lot of time, and use php to its potential Link to comment https://forums.phpfreaks.com/topic/29761-php-picture-listing-function/ Share on other sites More sharing options...
drifter Posted December 7, 2006 Share Posted December 7, 2006 for($i=1;$i<201;$i++){ echo "<img src='/pictures/image" . $i . ".jpg'>";} Link to comment https://forums.phpfreaks.com/topic/29761-php-picture-listing-function/#findComment-136644 Share on other sites More sharing options...
mikeymizrahi Posted December 7, 2006 Author Share Posted December 7, 2006 i think i follow, but can you explain that? Link to comment https://forums.phpfreaks.com/topic/29761-php-picture-listing-function/#findComment-136647 Share on other sites More sharing options...
ki Posted December 7, 2006 Share Posted December 7, 2006 not sure$total = "5";for($asd = 1; $a <= $total; $asd++) {echo "<img src=\"images/pic".$asd.".jpg\">";}not sure if that will work, but you could also try a directory reading but thats not very effective. Link to comment https://forums.phpfreaks.com/topic/29761-php-picture-listing-function/#findComment-136651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.