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.

  • Do you just want to display the images on the node page or do you actually want them to be attached to the node (so they would show up on the node edit page as well where you can manage them)?
    – Madis
    May 10, 2012 at 20:49
  • Maybe you are looking for something like drupal.stackexchange.com/questions/11413/… May 10, 2012 at 23:22
  • Hello, Dooshta. I would prefer the latter. I would like to be able to edit them in a table or divs. That way I can have total control of what is being displayed, dynamically with the content and style wise with the css. thanks.
    – James30
    May 10, 2012 at 23:52

1 Answer 1


If by 'programmatically' you mean using PHP, then there seem to be two good options.

  1. Create a template file, include the fancybox library if not already loaded, load the file path/names from your image directory into an array, tweak the array as needed, and call fancybox with the paths in your array.

  2. Create a custom module that does essentially the same thing, but here you can also add an admin view to manage the images, set custom permissions, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.