Is there a way to programmatically add an array of images from a particular file path?? I want to add all the images from one folder in my drupal site and add fancybox styling to them, can this be done? I’ve tried looking on drupal.org with no success. Thanks for the help.
Share
Sure you can, just enable the php filter module, and put the php code to do this in the body of the node. Make sure you set the format of the body to PHP and not plain text or html.
So if the image is in your theme folder, you can grab and display display it using:
You can get all files within a directory using php’s scandir function. This function will return an array of all files within your files directory, after which you can loop through this array and output all image files to the screen like: