Group based image quality


I'm trying to figure out how to add a group based access to image quality, in the same way that the directories / galleries are group based accessible. Essentially, I want the guest group to be only able to access the small image quality.

I guess that one easy ad hoc way would be in the album.tpl.php, in the "foreach( $quality_links as $link){ ... }" part to add a check for group membership, and have the quality printed or not depending on the group. I've been browsing through the code but can't figure out what variable I need to invoke for the check-up.

I know it wouldn't be to hard to implement this as for the galleries, but the ad hoc solution would be fine for me for the moment.

Any help?