Badge query request: Received X likes in topic containing specific tag

select p.id, p.user_id, count(u.id)
from posts p
  left join post_uploads pu on p.id = pu.post_id
  left join uploads u on pu.upload_id = u.id 
where u.original_filename similar to '%.(jpg|png|)'
group by p.id, p.user_id
  having count(u.id) > 1

This finds all posts with at least two uploads that are images (end in either .jpg or .png).