$image_id = "ID_OF_YOUR_IMAGE";
function download_preview_image($image_id) {
$url = "https://api.autoenhance.ai/v3/images/$image_id/preview";
$options = array(
'http' => array(
'method' => 'GET'
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
return 'Error downloading image';
}
$image_source = json_decode($result, true);
return $image_source;
}