show alt tag only if it exists

I have a collection which has an assets field type named "gallery". In the assets container I defined alt tags for some of the images. In the front end I would like to loop through my "gallery" fieldtype and fetch the images, I also want to fetch the alt tag but only if the alt tag exists, otherwise I would like to use a different value from my collection's fieldset as the alt tag, like the collection's title for instance, but not the asset's title. I can't really seem to figure it out, I've tried many versions to varying degrees of success, but I think this logic illustrates what I'm trying to do:

{{ gallery }}
  <img src="{{ value }}" 
     {{ if {assets:alt} }}  
        alt="{{ value | get:alt }}"
    {{ else }}
     alt="{{ title }}"
     {{ /if }}
{{ /gallery }}
>>>>>>> Unanswered <<<<<<<
3 Replies