Configuring Google Image (API) in the Image Bank
This method allows you to retrieve the images available on Google Images thanks to its API.
Here are the configurable options:
- Custom Search Engine ID: The search engine identifier. See the explanation below.
- Google API Key: Required to use the Google API. See the explanation below.
- Language: Many languages are available. Choose the language that matches the language of your WordPress content.
- Specified color predominantly: The primary color of the generated image.
- Filetype: Extension of the generated image. Available choices: bmp, gif, jpg, png, webp.
- Rights: Select which licenses apply to images. Selected licenses are cumulative.
- Image size: The size of the image.
- Image Type: Available choices: face, photo, clipart, line art, animated.
- Safety level: Whether or not to display potentially offensive images. Possible choices: Moderate (default), Activate, Off.
To get the API key, go to the Google APIs Console and select Credentials > Create credentials > API key. Copy the key. Finally, you need to enable search via the API. Go to Library > Custom Search API and enable the API.
The gif image below shows the actions to perform:
The second step is to get the identifier of the search engine we are going to create.
Go to Custom Search, then add a URL and a name to your search engine. Then go to edit the search engine you created (Edit Search Engine > Setup). At the bottom of the page, in the “Sites to search” section, delete the site that is there by default (otherwise the search for images will be done only on your site and not on the entire web!) Finally, retrieve the ID using the Search Engine ID button.
Actions to be taken:
Once the two identifiers (API key & search engine ID) have been retrieved, enter them in the plugin settings.