Provide a default image for image field programmatically at theme level I have an image field on a node, which will not always be populated. In the case where the field is empty (no image), I want to alter the markup to display a random image which always exists in a specified directory of the files dir. The second part isn't a problem, but I am struggling with the alter part. I am trying to find the correct hook or theme function to test if the image field is empty and then render some markup in it's place. I am lead towards a theme function. Any ideas?

Thanks
use hook_node_view_alter. Check over there that if images is empty then fetch image from your whatever custom directory and print it. For printing an image use theme_image.