Properties

$id

$id : 

Type

$id_image

$id_image : integer

Type

integer — Image ID

$id_product

$id_product : integer

Type

integer — Product ID

$position

$position : integer

Type

integer — Position used to order images of the same product

$cover

$cover : boolean

Type

boolean — Image is cover

$legend

$legend : string

Type

string — Legend

$image_format

$image_format : string

Type

string — image extension

$source_index

$source_index : string

Type

string — path to index.php file to be copied to new image folders

$definition

$definition : 

Type

$folder

$folder : string

Type

string — image folder

$existing_path

$existing_path : string

Type

string — image path without extension

$access_rights

$access_rights : integer

Type

integer — access rights of created folders (octal)

$_cacheGetSize

$_cacheGetSize : 

Type

Methods

__construct()

__construct(  $id = null,   $id_lang = null) 

Parameters

$id
$id_lang

add()

add(  $autodate = true,   $null_values = false) 

Parameters

$autodate
$null_values

delete()

delete() 

getImages()

getImages(integer  $id_lang, integer  $id_product, integer  $id_product_attribute = NULL) : array

Return available images for a product

Parameters

integer $id_lang

Language ID

integer $id_product

Product ID

integer $id_product_attribute

Product Attribute ID

Returns

array —

Images

getAllImages()

getAllImages() : array

Return Images

Returns

array —

Images

getImagesTotal()

getImagesTotal(integer  $id_product) : integer

Return number of images for a product

Parameters

integer $id_product

Product ID

Returns

integer —

number of images

getHighestPosition()

getHighestPosition(integer  $id_product) : integer

Return highest position of images for a product

Parameters

integer $id_product

Product ID

Returns

integer —

highest position of images

deleteCover()

deleteCover(integer  $id_product) : boolean

Delete product cover

Parameters

integer $id_product

Product ID

Returns

boolean —

result

getCover()

getCover(integer  $id_product) : boolean

Get product cover

Parameters

integer $id_product

Product ID

Returns

boolean —

result

duplicateProductImages()

duplicateProductImages(integer  $id_product_old, boolean  $id_product_new,   $combination_images) 

Copy images from a product to another

Parameters

integer $id_product_old

Source product ID

boolean $id_product_new

Destination product ID

$combination_images

duplicateAttributeImageAssociations()

duplicateAttributeImageAssociations(  $combination_images) : boolean

Duplicate product attribute image associations

Parameters

$combination_images

Returns

boolean

positionImage()

positionImage(integer  $position, boolean  $direction) 

Reposition image

Parameters

integer $position

Position

boolean $direction

Direction

updatePosition()

updatePosition(integer  $way, integer  $position) : integer

Change an image position and update relative positions

Parameters

integer $way

position is moved up if 0, moved down if 1

integer $position

new position of the moved image

Returns

integer —

success

getSize()

getSize(  $type) 

Parameters

$type

getWidth()

getWidth(  $params,   $smarty) 

Parameters

$params
$smarty

getHeight()

getHeight(  $params,   $smarty) 

Parameters

$params
$smarty

clearTmpDir()

clearTmpDir() 

Clear all images in tmp dir

deleteProductAttributeImage()

deleteProductAttributeImage() 

Delete Image - Product attribute associations for this image

deleteImage()

deleteImage(  $force_delete = false) 

Delete the product image from disk and remove the containing folder if empty Handles both legacy and new image filesystems

Parameters

$force_delete

deleteAllImages()

deleteAllImages(string  $path, string  $format = 'jpg') : boolean

Recursively deletes all product images in the given folder tree and removes empty folders.

Parameters

string $path

folder containing the product images to delete

string $format

image format

Returns

boolean —

success

getExistingImgPath()

getExistingImgPath() 

Returns image path in the old or in the new filesystem

@ returns string image path

getImgFolder()

getImgFolder() : string

Returns the path to the folder containing the image in the new filesystem

Returns

string —

path to folder

createImgFolder()

createImgFolder() : boolean

Create parent folders for the image in the new filesystem

Returns

boolean —

success

getImgPath()

getImgPath() : string

Returns the path to the image without file extension

Returns

string —

path

getImgFolderStatic()

getImgFolderStatic(mixed  $id_image) : string

Returns the path to the folder containing the image in the new filesystem

Parameters

mixed $id_image

Returns

string —

path to folder

moveToNewFileSystem()

moveToNewFileSystem(  $max_execution_time) : mixed

Move all legacy product image files from the image folder root to their subfolder in the new filesystem.

If max_execution_time is provided, stops before timeout and returns string "timeout". If any image cannot be moved, stops and returns "false"

Parameters

$max_execution_time

Returns

mixed —

success or timeout

testFileSystem()

testFileSystem() : boolean

Try to create and delete some folders to check if moving images to new file system will be possible

Returns

boolean —

success

getPathForCreation()

getPathForCreation() : string

Returns the path where a product image should be created (without file format)

Returns

string —

path

replaceAttributeImageAssociationId()

replaceAttributeImageAssociationId(  $combination_images,   $saved_id,   $id_image) 

Parameters

$combination_images
$saved_id
$id_image