Tuesday, January 27, 2009

Accessing images from Google Sites

I recently wanted to modify my blog template a bit and had to create my own images and use them. I decided to upload the images to Google sites, where I have kept a bunch of my other files and preferred to maintain them all in one single location.

I uploaded the .gif images which had transparent areas in them and I copied the link and added to my harness blog and tested. I noticed that it displayed fine in Chrome, Firefox, Opera and Safari, but not really so in IE 6.

The transparent areas of the file were filled with a light blue color which was sufficient enough to mangle the appearance of the page.

The problem was with the URL I had used. The actual URL from the Google Sites was:
http://sites.google.com/site/codingpassion/Home/rails_main.gif?attredirects=0

For some reason, I found that query at the end of the URL to be unnecessary and removed it and hence faced this error.

This is what you see when accessing this link in IE6 (notice the blue/gray area? That is supposed to be transparent)
http://sites.google.com/site/codingpassion/Home/rails_main.gif


This is what you see when accessing this link in IE6 (notice the ?attredirects=0 query string)
http://sites.google.com/site/codingpassion/Home/rails_main.gif?attredirects=0


Fiddling with this further showed that when the attredirects=0 query string is passed along, Google appends the URL with an “auth” key value which in turn redirects to a more messy URL. Not sure what happens internally, probably they extract it from some location and authenticate if the file is available to all users, but adding that query string value back to the URL fixed things.

Update 1
Apparently there has been some issues with accessing images from Google sites:
http://groups.google.com/group/sites-help-somethingisbroken/browse_thread/thread/ec167ad76b4ea267/170c3709074f2bf6?lnk=gst&q=

Not sure what exactly Google does to fetch the image and why it would behave differently without the query string input.
Post a Comment