How to Create an Image Search on a Website

A picture is worth a thousand words. Adding the ability to search for images directly from your own website opens up the entire World Wide Web's collection of images to your viewers. Thanks to Google's comprehensive indexing of literally billions of images on the web and some simple decoding of URL parameters, you can create an image search tool on your website without needing to know complex scripting languages.

Things You'll Need

  • Computer with Internet connection
  • HTML editing program such as Notepad
  • A live website with FTP access


  1. Adding Google's Image Search to Your Website

    • 1

      Understand Google's Image Search URL. The important pieces that make up the URL you will use look like this: "" The part before the question mark references Google's Image Search address. Everything after it is the list of parameters that are used to define your particular search. The primary parameter is the "q=" parameter, which stands for "query". This is the part that includes your search terms. Additional parameters are noted below under the Advanced Parameters section.

    • 2

      Create a form that will pass inputted text from a text box on your site to the query parameter and submit it to Google's Image Search. You can paste the following code directly into your HTML file where you want the image search box to show up (see the References for an example of this on
      <form method="get" action="" target="_blank">
      <input type="text" name="q" />
      <input type="submit" value="Search Google Images" />

    • 3

      Save and publish your HTML file, then test it out.

    Advanced Parameters

    • 4

      Control the search results by defining additional parameters. Additional parameters include the following: "as_eq," "imgtype," "imgsz," "imgw," "imgh," "imgar," "as_filetype," "imgc," "as_sitesearch," "as_rights," "safe," and "as_st." Refer to for the visual interface for all of these parameters.

    • 5

      Make the selections you want on the visual interface link, then press "Google Search" to set an advanced parameter. Copy the URL that is returned.

    • 6

      Find the parameters that match your settings; for example, if you limited the "Domain" to "," then you would want a parameter that says, ""

    • 7

      Create a hidden input field in your form for each advanced parameter you want to include. Do so in the following manner: <input type="hidden" name="as_sitesearch" value="">, where "name" is equal to the parameter you want to include and "value" is equal to the value of that parameter.

    • 8

      Save and publish your HTML page and test.

Related Searches


  • Photo Credit search and magnifier buttons. (with clipping path) image by Andrey Zyk from

You May Also Like

Related Ads

Check It Out

7 Tips for Photographing Your Kids on Halloween