Add Internet Images To Your Website - Google Image Search
================================
CHALLENGE - No Album Art Images
================================
Last night I stayed up super late playing with the Google API.
I'm building a mobile web page for my karaoke song list. Users can search the song library by artist, song name, or volume.
The functionality of the page was written in 2 hours; however, the interface is taking me days to build. No matter what I do, I cannot get the page to feel like it's part of the Ipod Touch/Iphone. This is no easy task and is my ultimate goal.
Presently, the search results are returned as a long list. This works great in a standard web browser but not so easy to navigate in a mobile site.
My idea is to create a horizontal slider to allow the user to slide through the results - sort of like a photo gallery slider. I easily found a javascript slider last night but then faced an issue.
My application doesn't have any pictures associated with the song or the artist. Collecting that many images is a lot of manual work. So, then I thought about how ITunes or other apps retrieve album art for MP3 songs. I did some research but couldn't find any public or private album art database - at all! All I could find were websites that allowed you to search their database and find album art but you had to manually download the images. So, I investigated their URLS to see if I could easily send params and get results - but no luck. The sites only let you search about 4 times, before they make you sign up.
If anyone knows of a public album art database like the cddb database, then please let me know. I haven't researched if CDDB can retrieve thumbnails, too, though. Hmm...
http://en.wikipedia.org/wiki/CDDB
http://en.wikipedia.org/wiki/Freedb
I found these two application that both do what I'm trying to do; however, they do it from a desktop application. I can't tell what language they used or how they're retrieving the images from the internet.
EMix Cover Downloader:
http://www.freedownloadmanager.org/downloads/e_mix_Cover_Downloader_56132_p/
Album Art Downloader XUI (open source):
http://sourceforge.net/apps/mediawiki/album-art/index.php?title=Main_Page
Found open source Discogs - they send back images. Registered with them. This may work, too. You call a URL and they return XML. If the XML contain image tag, then there's a picture associated with the artist.
http://www.discogs.com/help/api
Found Musicbrainz C# web service. Can't tell by their page if they return images though...
http://musicbrainz.org/doc/Musicbrainz_Sharp
So, I continued thinking. Whenever I need an image, I always go to the Google image search. So, then I thought of the Google API did some research and found the Google Image Search API! GREAT!!! This would work if I could just get the results in my web application.
================================
SOLUTION - Google Image Search
================================
The first Google API page I encountered mentioned using Javascript. I was first turned off by this since I had to register for a Google API key. After a few minutes, I gave up and registered. The registration took seconds to complete and Google instantly provided me with a key. Cool!
I went straight to the Google code playground and copied the code, added my new key, and ran the appliation. I immediately saw Google Image Search images in my personal web page. I was so pleasantly surprised to see how easy this was to do from Javascript.
This was great however I use C# and needed the search results to be accesible from my C# classes. I am using a ASP.NET repeater so this would be ideal.
I continued to search...i knew they had to have some .NET API - somewhere on Google's site.
....then finally I found it....yippeeee!!!
All I needed in my C# code was the Google.API.Search dll to expose the Google API. I downloaded this zip file from Google...
http://code.google.com/p/google-api-for-dotnet/downloads/detail?name=GoogleSearchAPI_0.3.1.zip
The zip file contains the Google.API.Search dll, a read me file, and a CHM help file. It has everything I needed to get started.
Here's the code I wrote and in a matter of 15 minutes, I had Google image search results in my C# class. COOL!!!
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Google.API.Search; namespace Karaoke.Controls { public partial class Slider : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { /*Searched the web for images via Google*/ GimageSearchClient ImageSearch = new GimageSearchClient("www.visotech.info"); IList<IImageResult> results = ImageSearch.Search("Lisa Lisa Head to toe", 10, null, null, null, null, null, null); Response.Write("got google" + results.Count); foreach (IImageResult res in results) { string x = res.Url; Response.Write(x + "<br/>"); } } } }So, now I can send the Google API an artist name and song name and get an image that's related to the song.
Thank you Google for making this soooo easy!
Signing Off,
Vivian
ViSO Tech


Comments