Manual:Hooks/BeforeGalleryFindFile

Details
$imagegallery - The ImageGallery object.

$title - The title object of the image.

$time - The time the image was uploaded.

To specify a specific instance of the file to use in the gallery, an extension must set the $title and the $time to correct values for a revision of the file.