From 96366548a38fe314d9c9781bde86161952d2baa7 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 17 Nov 2016 10:49:00 +0200 Subject: [PATCH] fix avatar for deleted user and campaign tracker 1px --- application/Espo/EntryPoints/Avatar.php | 10 +++++++++- .../Modules/Crm/EntryPoints/CampaignTrackOpened.php | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/application/Espo/EntryPoints/Avatar.php b/application/Espo/EntryPoints/Avatar.php index c95672c0c8..9a98997d78 100644 --- a/application/Espo/EntryPoints/Avatar.php +++ b/application/Espo/EntryPoints/Avatar.php @@ -77,7 +77,15 @@ class Avatar extends Image $user = $this->getEntityManager()->getEntity('User', $userId); if (!$user) { - throw new NotFound(); + header('Content-Type: image/png'); + $img = imagecreatetruecolor(14, 14); + imagesavealpha($img, true); + $color = imagecolorallocatealpha($img, 127, 127, 127, 127); + imagefill($img, 0, 0, $color); + imagepng($img); + imagecolordeallocate($img, $color); + imagedestroy($img); + exit; } if (isset($_GET['attachmentId'])) { diff --git a/application/Espo/Modules/Crm/EntryPoints/CampaignTrackOpened.php b/application/Espo/Modules/Crm/EntryPoints/CampaignTrackOpened.php index e510f955a8..03f3ecb2b9 100644 --- a/application/Espo/Modules/Crm/EntryPoints/CampaignTrackOpened.php +++ b/application/Espo/Modules/Crm/EntryPoints/CampaignTrackOpened.php @@ -86,11 +86,11 @@ class CampaignTrackOpened extends \Espo\Core\EntryPoints\Base $img = imagecreatetruecolor(1, 1); imagesavealpha($img, true); - $color = imagecolorallocatealpha($img, 0, 0, 0, 127); + $color = imagecolorallocatealpha($img, 127, 127, 127, 127); imagefill($img, 0, 0, $color); imagepng($img); - imagecolordeallocate($color); + imagecolordeallocate($img, $color); imagedestroy($img); } }