There is no $g2_album_id here

I assume this should be $g2_album->getId() instead