I'd like the images in the attachment pages you reach via gallery shortcode thumbnails to link to the next attachment page of the post - now, they link to the media itself.
I know that I could just add the link in the image upload dialog, but I would like it to be automatic - editing the media.php file.
Has anyone any idea about how to do it? The gallery shortcode section of media.php seems to be screaming "danger! danger!" and I'm afraid to experiment.