imagesavealpha
Intervention/image
Supported Versions: PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8
Whether to retain full alpha channel information when saving PNG images
imagesavealpha
(
GdImage $image
,
bool $enable
):
bool
imagecolortransparent
(
$modified
,
$transColor
);
} else {
imagealphablending
(
$modified
,
false
);
imagesavealpha
(
$modified
,
true
);
}
src/Intervention/Image/Gd/Commands/ResizeCommand.php
$height
=
imagesy
(
$core
);
$clone
=
imagecreatetruecolor
(
$width
,
$height
);
imagealphablending
(
$clone
,
false
);
imagesavealpha
(
$clone
,
true
);
$transparency
=
imagecolorallocatealpha
(
$clone
,
0
,
0
,
0
,
127
);
imagefill
(
$clone
,
0
,
0
,
$transparency
);
src/Intervention/Image/Gd/Driver.php
ob_start
();
$resource
=
$this
->
image
->
getCore
();
imagealphablending
(
$resource
,
false
);
imagesavealpha
(
$resource
,
true
);
imagepng
(
$resource
,
null
, -
1
);
$this
->
image
->
mime
=
image_type_to_mime_type
(
IMAGETYPE_PNG
);
$buffer
=
ob_get_contents
();
src/Intervention/Image/Gd/Encoder.php
ob_start
();
imagepalettetotruecolor
(
$this
->
image
->
getCore
());
imagealphablending
(
$this
->
image
->
getCore
(),
true
);
imagesavealpha
(
$this
->
image
->
getCore
(),
true
);
imagewebp
(
$this
->
image
->
getCore
(),
null
,
$this
->
quality
);
$this
->
image
->
mime
=
defined
(
'IMAGETYPE_WEBP'
) ?
image_type_to_mime_type
(
IMAGETYPE_WEBP
) :
'image/webp'
;
$buffer
=
ob_get_contents
();
src/Intervention/Image/Gd/Encoder.php