convertImage

convertImage ( string pathImage , string[default:JPG] _outputFormat , string _outputPath ) : void

Convert an image in another format.


Example


path_imageWEBP = path("tmp")+generateReference(null, 8)+".webp"
path_imageJPG = path("tmp")+generateReference(null, 8)+".jpg"
download(image, path_imageWEBP) //downloading of the image
convertImage(path_imageWEBP, "JPG", path_imageJPG) //conversion WebP -> JPG
path_server = upload(path_imageJPG, null, true) //uploading on Prestashop
function("add_image_on_server",[path_server]) //association with a Prestashop product

Parameters

pathImage

Path of the image to convert

_outputFormat (optional)

Format of the image. You can use : GIF, JPG, PNG, BMP, WebP, WBMP, TIFF.
For JPEG, BMP and WBMP if there is some transparency on the original image, it will be replaced by a white background.

_outputPath (optional)

Path of the output converted image. If null, the @pathImage is used.