Image_Importer
Class Image_Importer
Imports an image from a URL and attaches it to a post
- Full name:
\BigCommerce\Import\Image_Importer
Constants
Constant | Visibility | Type | Value |
---|---|---|---|
SOURCE_URL | public | ’bigcommerce_source_url’ | |
URL_ZOOM | public | ’url_zoom’ | |
URL_STD | public | ’url_standard’ | |
URL_THUMB | public | ’url_thumbnail’ | |
URL_TINY | public | ’url_tiny’ | |
IMAGE_ALT | public | ’image_alt’ | |
FULL_IMAGE_IMPORT | public | ’bigcommerce_allow_full_image_import’ | |
CDN_IMAGE_IMPORT | public | ’bigcommerce_allow_cdn_image_import’ | |
DISABLE_IMAGE_IMPORT | public | ’bigcommerce_disable_image_import’ | |
MIMES | public | [IMAGETYPE_GIF => ‘image/gif’, IMAGETYPE_JPEG => ‘image/jpg’, IMAGETYPE_PNG => ‘image/png’, IMAGETYPE_SWF => ‘image/swf’, IMAGETYPE_PSD => ‘image/psd’, IMAGETYPE_BMP => ‘image/bmp’, IMAGETYPE_TIFF_II => ‘image/tiff’, IMAGETYPE_TIFF_MM => ‘image/tiff’, IMAGETYPE_JPC => ‘image/jpc’, IMAGETYPE_JP2 => ‘image/jp2’, IMAGETYPE_JPX => ‘image/jpx’, IMAGETYPE_JB2 => ‘image/jb2’, IMAGETYPE_SWC => ‘image/swc’, IMAGETYPE_IFF => ‘image/iff’, IMAGETYPE_WBMP => ‘image/wbmp’, IMAGETYPE_XBM => ‘image/xbm’, IMAGETYPE_ICO => ‘image/ico’] |
Methods
__construct
public __construct(mixed $image_url, mixed $attach_to_post_id): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$image_url | mixed | |
$attach_to_post_id | mixed |
import
public import(false $is_category = false): false|int|\WP_Error
Parameters:
Parameter | Type | Description |
---|---|---|
$is_category | false |
should_load_from_cdn
Check if images serving from BigCommerce CDN is enabled
public static should_load_from_cdn(): bool
- This method is static.
is_image_import_allowed
Check whether image import is enabled
public static is_image_import_allowed(): bool
- This method is static.
has_local_featured_image
Is featured image exists only on WP side
public static has_local_featured_image(int $post_id): bool
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$post_id | int |
Automatically generated on 2025-01-21