fix avatar for deleted user and campaign tracker 1px

This commit is contained in:
yuri
2016-11-17 10:49:00 +02:00
parent 54cdd5180d
commit 3710073cdb
2 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -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'])) {
@@ -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);
}
}