I have a h:graphicImage in a composite component like this:
You can conditionally add attributes via .