stijn0713 Posted July 12, 2012 Share Posted July 12, 2012 Hello, i have an images directory and i want to loop through all the images names, how should i do it? Link to comment https://forums.phpfreaks.com/topic/265570-function-for-looping-through-images-on-a-file-directory/ Share on other sites More sharing options...
Psycho Posted July 12, 2012 Share Posted July 12, 2012 It depends. Are the images all of the same type (i.e. jpg or gif). If so, glob() is probably a good choice. Otherwise, it may be easier to to use the normal file reading functions: opendir(), readdir(), closedir(). Plenty of information and examples in the manual. Link to comment https://forums.phpfreaks.com/topic/265570-function-for-looping-through-images-on-a-file-directory/#findComment-1361064 Share on other sites More sharing options...
ignace Posted July 12, 2012 Share Posted July 12, 2012 Or use DirectoryIterator http://www.php.net/manual/en/directoryiterator.construct.php Link to comment https://forums.phpfreaks.com/topic/265570-function-for-looping-through-images-on-a-file-directory/#findComment-1361122 Share on other sites More sharing options...
stijn0713 Posted July 13, 2012 Author Share Posted July 13, 2012 Ok, i got it. Thanks! Link to comment https://forums.phpfreaks.com/topic/265570-function-for-looping-through-images-on-a-file-directory/#findComment-1361255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.