fix resize image

This commit is contained in:
2013-09-09 22:30:06 +02:00
parent 17eb91c7a0
commit 8ad6b988ee

View File

@@ -292,7 +292,7 @@ class Databap extends PhpObject
const REBOOT_DELAY = 15; //seconds const REBOOT_DELAY = 15; //seconds
const PM_SEP = '___'; const PM_SEP = '___';
const CHAT_IMG_MAX_WIDTH = 700; const CHAT_IMG_MAX_WIDTH = 700;
const CHAT_IMG_MAX_HEIGHT = 10000; const CHAT_IMG_MAX_HEIGHT = 2000;
const JSON_PREFIX = '[\-JSON-/]'; const JSON_PREFIX = '[\-JSON-/]';
//Options Constants //Options Constants
@@ -4384,7 +4384,9 @@ class ToolBox
list($iWidth, $iHeight) = getimagesize($sInPath); list($iWidth, $iHeight) = getimagesize($sInPath);
if($iWidth > $iMaxWidth || $iHeight > $iMaxHeight) if($iWidth > $iMaxWidth || $iHeight > $iMaxHeight)
{ {
if($iWidth > $iHeight) $dResizeDeltaWidth = $iWidth - $iMaxWidth;
$dResizeDeltaHeight = $iHeight - $iMaxHeight;
if($dResizeDeltaWidth > $dResizeDeltaHeight)
{ {
$iResizedWidth = $iMaxWidth; $iResizedWidth = $iMaxWidth;
$iResizedHeight = ($iResizedWidth / $iWidth) * $iHeight; $iResizedHeight = ($iResizedWidth / $iWidth) * $iHeight;