Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

How to make Google images search engine

1) create a custom search engine by Click here


2) click to add button and insert required data then click create at bottom
3) after creating -> click on setup tab to modify your search engine such as:
Enable Image search option.
In Sites to search option select (Search the entire web but emphasize
included sites)
4) Update your setting
5) Look and feel tab: used to modify style for results & something important to do
To enable Thumbnails in search results .
6) Go to link https://console.developers.google.com/apis
To make API key but first:
1. Click new credentials -> select API key
2. Select browser key ->then create ( you will be popped by api key)
3. From menu button
Go to API manager
4. In google APIs tab search for Custom Search API
5. Select Custom Search API
6. Click

button

Now Use this code to get images ( thumb & full url )
<html>
<head>
<title>JSON/Atom Custom Search API Example</title>
</head>
<body>
<div id="content"></div>
<script>
function hndlr(response) {
Object.keys(response).forEach(function (key) {
console.log(response[key]);
});
for (var i = 0; i < response.items.length; i++) {
var item = response.items[i];
// in production code, item.htmlTitle should have the HTML entities
escaped.

//document.getElementById("content").innerHTML += "<img
src="+item.link+" />" ;
var thumbnailLink = item.image.thumbnailLink ;
var FullImagelLink = item.link ;
document.getElementById("content").innerHTML += "<img src="+
thumbnailLink+" />" ;
}
}
</script>
<script src="https://www.googleapis.com/customsearch/v1?
key=AIzaSyAGxspFSKOT3cmFNUfFW4N8463rXJjHZek&amp;cx=00907672
2715317521305:pgtgbitiq5w&amp;q=nature&amp;searchType=image&a
mp;callback=hndlr">
</script>
</body>
</html>

You might also like