From 208ccfe3abc512286816cd71ab75cd460c6ef106 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 18 Aug 2020 17:05:58 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03257=20Fix=20cannot=20create=20objects?= =?UTF-8?q?=20with=20AttributeImage=20from=20extkey=20widget=20on=20PHP=20?= =?UTF-8?q?7.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index d0298dc2c..a39bd69d9 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -3796,19 +3796,24 @@ EOF break; case 'Image': + $value = null; $oImage = utils::ReadPostedDocument("attr_{$sFormPrefix}{$sAttCode}", 'fcontents'); - $aSize = utils::GetImageSize($oImage->GetData()); - $oImage = utils::ResizeImageToFit($oImage, $aSize[0], $aSize[1], $oAttDef->Get('storage_max_width'), - $oAttDef->Get('storage_max_height')); + if (!is_null($oImage->GetData())) + { + $aSize = utils::GetImageSize($oImage->GetData()); + $oImage = utils::ResizeImageToFit( + $oImage, + $aSize[0], + $aSize[1], + $oAttDef->Get('storage_max_width'), + $oAttDef->Get('storage_max_height') + ); + } $aOtherData = utils::ReadPostedParam("attr_{$sFormPrefix}{$sAttCode}", null, 'raw_data'); if (is_array($aOtherData)) { $value = array('fcontents' => $oImage, 'remove' => $aOtherData['remove']); } - else - { - $value = null; - } break; case 'RedundancySetting':