mirror of
https://github.com/Tailszefox/Pony-Fusion.git
synced 2024-11-23 14:27:59 +01:00
Crop picture to remove swatch
This commit is contained in:
parent
ae12972d54
commit
38b7bf53cc
1 changed files with 8 additions and 0 deletions
|
@ -37,6 +37,14 @@ for($i = 0; $i < imagecolorstotal($from); $i++)
|
|||
}
|
||||
}
|
||||
|
||||
// Retain transparency
|
||||
imagealphablending($from, false);
|
||||
imagesavealpha($from, true);
|
||||
imagefill($from, 0, 0, imagecolorallocatealpha($from, 255, 255, 255, 127));
|
||||
|
||||
// Crop 1px from bottom to avoid showing swatch
|
||||
$from = imagecrop($from, ['x' => 0, 'y' => 0, 'width' => imagesx($from), 'height' => imagesy($from) - 1]);
|
||||
|
||||
if(!$debug)
|
||||
{
|
||||
header('Content-Type: image/png');
|
||||
|
|
Loading…
Reference in a new issue