fix getMimeType
This commit is contained in:
@@ -145,8 +145,11 @@ class ToolBox
|
|||||||
curl_setopt($oCurl, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($oCurl, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($oCurl, CURLOPT_HEADER, true);
|
curl_setopt($oCurl, CURLOPT_HEADER, true);
|
||||||
curl_setopt($oCurl, CURLOPT_NOBODY, true);
|
curl_setopt($oCurl, CURLOPT_NOBODY, true);
|
||||||
|
curl_setopt($oCurl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
|
||||||
|
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_exec($oCurl);
|
curl_exec($oCurl);
|
||||||
$sMimetype = curl_getinfo($oCurl, CURLINFO_CONTENT_TYPE);
|
$sMimetype = curl_getinfo($oCurl, CURLINFO_CONTENT_TYPE);
|
||||||
|
curl_close($oCurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Only sub type (after /)
|
//Only sub type (after /)
|
||||||
@@ -174,7 +177,8 @@ class ToolBox
|
|||||||
elseif(!array_key_exists('extension', $asOutInfo)) $sOutPath .= '.'.$sImageExt; //folder + filename, but getting ext from file info
|
elseif(!array_key_exists('extension', $asOutInfo)) $sOutPath .= '.'.$sImageExt; //folder + filename, but getting ext from file info
|
||||||
|
|
||||||
//New sizes
|
//New sizes
|
||||||
if(in_array($sImageExt, $asImageExts))
|
if(!in_array($sImageExt, $asImageExts)) $asResult['error'] = 'Wrong file type';
|
||||||
|
else
|
||||||
{
|
{
|
||||||
list($iWidth, $iHeight) = getimagesize($sInPath);
|
list($iWidth, $iHeight) = getimagesize($sInPath);
|
||||||
if($iWidth > $iMaxWidth || $iHeight > $iMaxHeight)
|
if($iWidth > $iMaxWidth || $iHeight > $iMaxHeight)
|
||||||
@@ -241,7 +245,6 @@ class ToolBox
|
|||||||
$asResult['height'] = $iResizedHeight;
|
$asResult['height'] = $iResizedHeight;
|
||||||
$asResult['out'] = $sOutPath;
|
$asResult['out'] = $sOutPath;
|
||||||
}
|
}
|
||||||
else $asResult['error'] = 'Wrong file type';
|
|
||||||
|
|
||||||
if($bDeleteIn && $asResult['error']=='' && $sInPath != $sOutPath) unlink($sInPath);
|
if($bDeleteIn && $asResult['error']=='' && $sInPath != $sOutPath) unlink($sInPath);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user