Qual: Fix nullable and typing (phan notices)
This commit is contained in:
parent
a35d502409
commit
f64c0818f9
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -315,6 +315,10 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
|||
break;
|
||||
}
|
||||
|
||||
if ($img === null) {
|
||||
return "Error: Could not create Image from '$filetoread'";
|
||||
}
|
||||
|
||||
// Create empty image for target
|
||||
if ($newExt == 'gif') {
|
||||
// Compatibility image GIF
|
||||
|
|
@ -615,6 +619,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
|||
|
||||
// Variable initialization according to image extension
|
||||
$img = null;
|
||||
$extImg = null;
|
||||
switch ($infoImg[2]) {
|
||||
case IMAGETYPE_GIF: // 1
|
||||
$img = imagecreatefromgif($filetoread);
|
||||
|
|
@ -805,7 +810,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
|||
imagejpeg($imgThumb, $imgThumbName, $newquality); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal,PhanPossiblyUndeclaredVariable
|
||||
break;
|
||||
case IMAGETYPE_PNG: // 3
|
||||
imagepng($imgThumb, $imgThumbName, $newquality); // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
|
||||
imagepng($imgThumb, $imgThumbName, !is_numeric($newquality) ? -1 : (int) $newquality); // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
|
||||
break;
|
||||
case IMAGETYPE_BMP: // 6
|
||||
// Not supported by PHP GD
|
||||
|
|
|
|||
Loading…
Reference in a new issue