Enhance error management
This commit is contained in:
parent
a36df785b0
commit
9dc36d13c3
@ -203,6 +203,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Test function to read source image exists
|
||||
$imgfonction = '';
|
||||
switch ($infoImg[2]) {
|
||||
case 1: // IMG_GIF
|
||||
@ -228,6 +229,34 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
}
|
||||
|
||||
// Test function to write target image exists
|
||||
if ($filetowrite) {
|
||||
$imgfonction = '';
|
||||
switch ($newExt) {
|
||||
case 'gif': // IMG_GIF
|
||||
$imgfonction = 'imagecreatefromgif';
|
||||
break;
|
||||
case 'jpg': // IMG_JPG
|
||||
$imgfonction = 'imagecreatefromjpeg';
|
||||
break;
|
||||
case 'png': // IMG_PNG
|
||||
$imgfonction = 'imagecreatefrompng';
|
||||
break;
|
||||
case 'bmp': // IMG_WBMP
|
||||
$imgfonction = 'imagecreatefromwbmp';
|
||||
break;
|
||||
case 'webp': // IMG_WEBP
|
||||
$imgfonction = 'imagecreatefromwebp';
|
||||
break;
|
||||
}
|
||||
if ($imgfonction) {
|
||||
if (!function_exists($imgfonction)) {
|
||||
// Fonctions de conversion non presente dans ce PHP
|
||||
return 'Write of image not possible. This PHP does not support GD functions '.$imgfonction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read source image file
|
||||
switch ($infoImg[2]) {
|
||||
case 1: // Gif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user