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? Quote 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. Quote 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 Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.