So, I've been messing around with the GMaps API, trying to create my custom map type. It took me a lot of time, so I decided to share the code I ended up with.
This script serves content to the Google Maps API. It divides each requested tile into 8x8=64 squares and for each one displays the highest-rated picture that belongs to it.
//this script should serve content for the gmaps api
//we're echo-ing out an image, so we should show that