You can get the source code to the gallery 3.0.12/3.1.12 version on the dnn site, just go the old downloads section under the gallery project and you should be able to find it.
Note: The gallery 3.x is beta, .NET 1.1, and full of bugs. So while you _can_ have the source code, I'm not sure why you would want it. No the 3.x versions are not really compatible with DNN 4.7 or higher, and since the 3.x version is a .NET 1.1 module it is a pain to compile for DNN 4.x.
The version 3.x is the most recent release. Version 4.x of the gallery module is currently in private testing, when it becomes available, the source code for it will also become available. The new version will be compatible with the DNN 4.8.