ok so i have a folder that was created after this answer was used
so now i have a folder with with many folders in it
each one having images and a .txt file
the images are almost all .jpg
so now i want to display a image from each folder, using php
i want to display the first image from each folder, and if there is no images i want to display a default image
so by just have the location of the folder i want to display the image
any ideas?
it can be through php or javascript, no other languages please
it will untimely be used in a wordpress theme with the folder location being a custom field parameter
Try using PHP glob – it returns an array of filenames in any folder you give it. You can filter by *.jpg, and just use the first item in the array.
For example, I use:
which makes an array of all filenames called image[something].jpg in the folder
$folder.