mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 23:32:17 +02:00
utils::GetImageSize can be simplified since minimal PHP version is 7.1.3
This commit is contained in:
committed by
Molkobain
parent
9ca106d889
commit
ce01dad875
@@ -1944,28 +1944,18 @@ class utils
|
|||||||
|
|
||||||
return $sCss;
|
return $sCss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the size of an image from a string.
|
||||||
|
*
|
||||||
|
* @see \getimagesizefromstring()
|
||||||
|
* @param $sImageData string The image data, as a string.
|
||||||
|
*
|
||||||
|
* @return array|false
|
||||||
|
*/
|
||||||
public static function GetImageSize($sImageData)
|
public static function GetImageSize($sImageData)
|
||||||
{
|
{
|
||||||
if (function_exists('getimagesizefromstring')) // PHP 5.4.0 or higher
|
return @getimagesizefromstring($sImageData);
|
||||||
{
|
|
||||||
$aRet = @getimagesizefromstring($sImageData);
|
|
||||||
}
|
|
||||||
else if(ini_get('allow_url_fopen'))
|
|
||||||
{
|
|
||||||
// work around to avoid creating a tmp file
|
|
||||||
$sUri = 'data://application/octet-stream;base64,'.base64_encode($sImageData);
|
|
||||||
$aRet = @getimagesize($sUri);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Damned, need to create a tmp file
|
|
||||||
$sTempFile = tempnam(SetupUtils::GetTmpDir(), 'img-');
|
|
||||||
@file_put_contents($sTempFile, $sImageData);
|
|
||||||
$aRet = @getimagesize($sTempFile);
|
|
||||||
@unlink($sTempFile);
|
|
||||||
}
|
|
||||||
return $aRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user