WooCommerce Code Reference

ContentProcessor
in package

ContentProcessor class.

Process images for content

Table of Contents

adjust_image_size()  : string
Adjust the size of images for optimal performance on products and patterns.
summarize_business_description()  : mixed|WP_Error
Summarize the business description to ensure better results are returned by AI.
verify_images()  : array<string|int, mixed>|int|mixed|string|WP_Error
Ensure that images are provided for assignment to products and patterns.

Methods

adjust_image_size()

Adjust the size of images for optimal performance on products and patterns.

public static adjust_image_size(string $image_url, string $usage_type) : string
Parameters
$image_url : string

The image URL.

$usage_type : string

The usage type of the image. Either 'products' or 'patterns'.

Return values
string

summarize_business_description()

Summarize the business description to ensure better results are returned by AI.

public static summarize_business_description(string $business_description, Connection $ai_connection, string $token[, int $character_limit = 150 ]) : mixed|WP_Error
Parameters
$business_description : string

The business description.

$ai_connection : Connection

The AI connection.

$token : string

The JWT token.

$character_limit : int = 150

The character limit for the business description.

Return values
mixed|WP_Error

verify_images()

Ensure that images are provided for assignment to products and patterns.

public static verify_images(array<string|int, mixed>|WP_Error $images, Connection $ai_connection, string $token, string $business_description) : array<string|int, mixed>|int|mixed|string|WP_Error
Parameters
$images : array<string|int, mixed>|WP_Error

The array of images.

$ai_connection : Connection

The AI connection.

$token : string

The JWT token.

$business_description : string

The business description.

Return values
array<string|int, mixed>|int|mixed|string|WP_Error