1 Hawk Vision

1.1 About Plugin

Q What changes will I see on my WordPress site after installation?

By installing it on your WordPress, there are no particular visual changes that will appear on your website.

The Hawk Vision plugin analyzes images uploaded to the media library by Google Cloud Vision AI and stores metadata such as crop hints for the images.

This plugin is intended for developers, as it aims to realize specific design ideas by using this metadata during implementation.

Q Which version of PHP and WordPress did you use to check the operation of the plugin?

It has been tested with the latest version of WordPress 5.8.3 and PHP 7.4.12.

Other legacy environments are expected to work, but PHP must be at least version 5.6.20 or later.

1.2 Using Google Cloud Platform

Q Why do I need an API key?

Hawk Vision plugin uses the power of Google Cloud Vision AI to analyze images uploaded to your media library.

In order to use Vision AI, you need to access a dedicated API provided by Google, which requires an API key.

Q I do not know how to create my billing account.

We have prepared a tutorial.

Please refer to “2.1 How to create a billing account“.

Q I don't know how to issue an API key.

We have prepared a tutorial.

Please refer to “2.2 How to get a Cloud Vision API key“.

1.3 Cloud Vision API fees

Q Can I use the API for free?

No.

All use of Google Cloud Vision API is subject to billing, and as such, you must also create a billing account with Google.

However, Vision API has a free usage limit of 1,000 units per month, so if the number of units used by Hawk Vision plug-in is less than the monthly limit, the API can be used for free.

  • Please refer to the official Google documentation for pricing details.

Q About the pay-as-you-go pricing of the Vision API that is charged for using Hawk Vision.

Hawk Vision uses CROP_HINTS feature of Vision API. Please refer to “Crop Hints” for more information about the price.

Q What is a “unit” ?

This is the unit used to calculate the fee for using Cloud Vision API. 1 unit is consumed by Hawk Vision plugin for each image analysis process.

Q When will the units be consumed?

1. When you upload a new image to the media library.

  • Whether or not to automatically analyze crop hints upon upload can be selected in the settings page.

2. When you edit or restore an image in the WordPress image editor.

  • Editing or restoring an image changes the image file and its contents, so the image needs to be reanalyzed.
  • Whether to automatically reanalyze crop hints when editing or restoring images can be selected in the settings page.

Q I am worried about unintended overuse of the API.

You can set “Capping API usage ” in Google Cloud console.

You can also set up “Create, edit, or delete budgets and budget alerts” to be notified by email when you exceed a certain amount of usage.

1.4 Crop Hints

Q Does Hawk Vision use the API each time you load crop hint data in a template?

No.

The generation of Smart Cropped Images uses the crop hint data stored in the WordPress database, so it need not to use the API.

2 Google Cloud Platform

In order to use Hawk Vision plugin, you need to set up a Google Cloud Platform billing account and issue an API key for Cloud Vision API.

Since API keys are not restricted by default, we strongly recommend that you set usage restrictions when you issue the key to prevent unauthorized use.

  • Cloud Vision API has a monthly free usage limit, but even if your API usage is within the monthly free limit, you still need to set up a billing account such as a credit card.
  • This plugin and its creators cannot be held responsible for any damages such as the actual cost of the Cloud Platform due to the unauthorized use of Cloud Vision API key by a third party. Please handle the API key with care.

2.1 How to create a billing account.

  • The following tutorial is an example of a billing account that has not yet been created.
  • The screen display may vary depending on the service usage status of each Google account you are logged into.
  • For more information on how to create a billing account, please refer to the official Google document.
  1. 2.1.1 Accessing Google Cloud Platform console.

    Access the Google Cloud Platform console to set up your billing account.

  2. 2.1.2 Accessing “Billing”.

    Select from the side menu to set up your billing account.

  3. 2.1.3 Start creating a billing account.

    Click button to start creating an account.

  4. 2.1.4 Decide a name of your account.

    Enter Name and click button.

  5. 2.1.5 Enter your payments profile.

    Fill in the following fields in the input form: Account typeName and AddressPayment method.

    Make sure all the information is correct before clicking button to create your profile.

  6. 2.1.6 Complete the creation of your billing account.

    A valid billing account has been created. You are now ready to start using Google Cloud Platform.

2.2 How to get a Cloud Vision API key.

  • The screen display of the following tutorial may vary depending on the service usage of the Google Account you are signed in to.
  • For details on how to issue an API key, please refer to the official Google document.
  1. 2.2.1 Accessing Google Cloud Platform console.

    Access the Google Cloud Platform console to create and configure a key for Cloud Vision API. Click button at the top of the page.

  2. 2.2.2 Start creating a project.

    Click button in the modal window.

  3. 2.2.3 Set up a project name and billing account.

    Enter a Project name and specify the account you created as the billing account. When you have finished entering the information, click button.

  4. 2.2.4 Accessing the project page.

    When a project is created, a notification will be displayed. Click button to go to the home of the project.

  5. 2.2.5 Accessing the API library.

    Select from the side menu to go to the API library.

  6. 2.2.6 Search Cloud Vision API.

    Find and select Cloud Vision API from the search field or list.

  7. 2.2.7 Enable Cloud Vision API.

    Click button to enable Cloud Vision API.

  8. 2.2.8 Accessing “Credentials”.

    Click from the menu.

  9. 2.2.9 Create an API key.

    Click button to display the drop-down menu, and select .

  10. 2.2.10 Confirm your API key.

    An API key will be created immediately. The random string that appears in Your API key is yours. Write down it or otherwise save it.

    The use of API key is not restricted immediately after it is created. In order to avoid the risk of the key being used by others in case of a leak, the button to go to the restriction setting screen.

  11. 2.2.11 Restrict API key.

    • Select the HTTP referrers (web sites) option in the Application restrictions section on “Restrict and rename API Key” screen.
    • Next, in the Website restrictions section, enter the “hostname” of your WordPress site. You can specify multiple hostnames or use wildcards. This will allow you to enable to use your API key on specific websites only.
    • If necessary, you can also set stronger usage restrictions by limiting the APIs used to Cloud Vision API only in the API Restrictions section.
  12. 2.2.12 Complete the API key settings.

    Click button to display the list of API keys that have been created. Be sure to check that the usage restrictions have been set.

3 Smart Cropped Images Addon

Q Does Hawk Vision use the API when generating Smart Cropped Images?

No.

The generation of Smart Cropped Images uses the crop hint data stored in the WordPress database, so it does not use the API.

4 Dominant Colors Addon

Q About the pay-as-you-go pricing of the Vision API that is charged for using Dominant Colors Addon.

Dominant Colors Addon uses IMAGE_PROPERTIES feature of Vision API. Please refer to “Image Properties” for more information about the price.

Q How many units are consumed in the extraction of crop hints and dominant color?

When performing image analysis under the use of Hawk Vision and Dominant Colors Addon, there are two possible API usage conditions.

  • Extract both a crop hint and dominant colors at the same time.
  • Extract only the dominant color (since the crop hint already exists)

In both cases, the number of units required to analyze one image is 1.