google-image-search Get images by given query from "Google Image Search API JSON interface"

Google Image search (yii extension)

  1. Limitations by service
  2. 1. With given example
  3. 2. Write your own controller/view
  4. Screenshots

This extension use "Google Image Search API JSON interface"

Limitations by service

  • Max results per page: 8
  • Max pages: 8

This means you can not get more than 8 pages by one given query string. BUT you can change some of the url params and get different results.

One example is to change image type [png|jpg|gif|bmp] (but not search word) so you can get 4 times more results querying like this. Start with 8 pages of png, and continue with other types. In result you get 32 pages and every page with 8 results.


  • cURL

Extension includes

  • GoogleImageSearch (CComponent) - it can be used alone with your code
  • ImageSearchController (CExtController) - Example of component use
  • views/search.php - html/js/css view for ImageSearchController (jQuery required)

How to use

You can use it in two ways.

  1. Based on given example
  2. Write your own controller/view

But both ways need same init configuration:


    // Google image search component
         //'cacheSec' => 3600, //default 1week


1. With given example

For given example you need to add configuration to your controllerMap:

        //'layout' => '//layouts/layout', //default: layouts/main

Now you can access example by adding /imgSearch/search to your base url (Result:

2. Write your own controller/view

You can use GoogleImageSearch component and use it where you want in you code. Here is a quick example:

        $imgSearch = Yii::app()->imgSearch;

        // All possible params:
            'rsz' => 4, //default: 8
            //'as_filetype' => 'png', //default to all types

        // OR set params one by one

        $jsonRaw = $imgSearch->getResults( $searchString );
        $json = json_decode( $jsonRaw );

Available params

About & More

Project at bitbucket:


Search form Search results

3 0
Yii Version: 1.1
License: BSD-2-Clause
Category: Web Service
Tags: api, Google, search
Developed by:
Created on: Apr 8, 2013
Last updated: 11 years ago


show all

Related Extensions