Ask Dave Taylor
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube
  • Home
  • YouTube Videos
  • Top Categories
  • Subscribe via Email
  • Ask A Question
  • Meet Dave
  • Home
  • HTML & Web Page Design
  • How to Create Predefined Google Image Search Links?

How to Create Predefined Google Image Search Links?

March 18, 2013 / Dave Taylor / HTML & Web Page Design / No Comments

Thanks for the Amazon URL [see Creating Amazon Search Links]. That worked beautifully. In fact, I sent you $5.00 for coffee in thanks. Do you have a similar answer for accessing Google Images via their URL?

First off, thanks for the cup of coffee. I’m drinking it now as I type in this answer, actually, an almond milk chai from one of my favorite local coffee shops, Atlas Purveyors. Goodness, for sure.
In terms of what you ask, it’s actually pretty easy to reverse engineer just about any search site because they use what’s called a “GET method” of sending the search parameter to the system after you type in what you seek. That’s really what I tapped into on the Amazon search links that you have already read.
I’ve already written about Google Image Search more than once here, but I’ve never considered the question of building pre-defined searches as simple text links. Still, easily done, and the place to start is to read my previous article on adding a Google Image Search box to your page.
Armed with that information, let’s jump in!
Go to Google Image Search and search for, say, “Michelle Obama”. Your search results link in your browser will look like this:

google

Ugh, that’s really ugly, with lots going on. But, hmmm… what if I just deleted everything from the URL other than the q=”michelle+obama”, so the URL looks like this:

http://www.google.com/search?q=”michelle+obama”

This sort of live URL hacking is essential to these sort of reverse engineering tasks, and this particular one reveals that, well, this isn’t sufficient for the URL to work: the results are a regular Google search, not an image search. Conclusion: one of the missing parameters tells Google that you’re doing an image search, not a regular one, and we need to restore it for the link to work.
Again, I’ll edit directly in the Web browser address bar, reducing the search down to the pattern plus the two parameters that seem to be related to the type of search:

google

That works! But I’m curious, so my last hack attempt is to simply remove the “source=” parameter entirely, producing the even shorter URL:
google

Not sure what “tbm” stands for, but that’s the key attribute, and if you give it the value “isch” (image search, no doubt) the link will work fine.
Now to build the search pattern itself. If it’s just a word or couple of words, that’s easy, simply replace “michelle+obama” with what you’d like to specify. If it’s a more complex search with punctuation marks or other odd characters, my recommendation would be to actually do a search, then look closely at the resultant URL to see how the punctuation (etc) has been encoded.
Then you can do things like this: Look for images of disgraced pro biker Lance Armstrong or, better yet, images of news about Lance Armstrong that doesn’t mention doping.
How did I do those? Pretty straightforward, here’s the HTML for those:

Then you can do things like this: Look for images of disgraced pro biker <a href=”http://www.google.com/search?q=lance+armstrong&tbm=isch” target=”_blank”>Lance Armstrong</a> or, better yet, images of <a href=”http://www.google.com/search?q=%22lance+armstrong%22+news+-doping&tbm=isch” target=”_blank”>news about Lance Armstrong that doesn’t mention doping</a>.

The only subtlety is that since I’m quoting the URL for properly formed HTML, I can’t just use double quotes within the URL itself. Easy enough, simple replace each embedded ” symbol with a %22. Easy.
Hope you find this helpful and sufficiently informative to get you started!

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Recent Posts

  • Possible to Schedule a Windows 11 System Update & Restart?
  • How Can I Add Spacers and Divider Lines to my MacOS 12 Dock?
  • How Do I Pair Bluetooth Earbuds with my Google Chromebook?
  • How Can I Digitally Sign a PDF Document on my Windows PC?
  • Prevent “Printer Added” Notifications During Ubuntu Linux Boot?

On Our YouTube Channel

QueStyle M15 Mobile Lossless DAC / Headphone Amp -- UNBOXING & REVIEW

Google Pixel 6a -- Affordable Android 5G Smartphone -- UNBOXING

Categories

  • AdSense, AdWords, and PPC Help (106)
  • Amazon, eBay, and Online Shopping Help, (161)
  • Android Help (201)
  • Apple iPad Help (145)
  • Apple Watch Help (52)
  • Articles, Tutorials, and Reviews (344)
  • Auto Tech Help (11)
  • Business Advice (199)
  • Chrome OS Help (25)
  • Computer & Internet Basics (763)
  • d) None of the Above (165)
  • Facebook Help (383)
  • Google, Chrome & Gmail Help (179)
  • HTML & Web Page Design (245)
  • Instagram Help (47)
  • iPhone & iOS Help (607)
  • iPod & MP3 Player Help (173)
  • Kindle & Nook Help (93)
  • LinkedIn Help (85)
  • Linux Help (166)
  • Linux Shell Script Programming (87)
  • Mac & MacOS Help (894)
  • Most Popular (16)
  • Outlook & Office 365 Help (26)
  • PayPal Help (69)
  • Pinterest Help (53)
  • Reddit Help (18)
  • SEO & Marketing (81)
  • Spam, Scams & Security (92)
  • Trade Show News & Updates (23)
  • Twitter Help (217)
  • Video Game Tips (66)
  • Web Site Traffic Tips (62)
  • Windows PC Help (921)
  • Wordpress Help (204)
  • Writing and Publishing (72)
  • YouTube Help (46)
  • YouTube Video Reviews (159)
  • Zoom, Skype & Video Chat Help (57)

Archives

Social Connections:

Ask Dave Taylor


Follow Me on Pinterest
Follow me on Twitter
Follow me on LinkedIn
Follow me on Instagram


AskDaveTaylor on Facebook



microsoft insider mvp


This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to our terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. Our lawyer says "Thanks for your cooperation."
© 2022 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.
Privacy Policy - Terms and Conditions - Accessibility Policy