replaced image_id by gallery_post_id as per jacobgreenleaf suggestion.