private function FileCommited::addPaddingsToImageNative in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7
1 call to FileCommited::addPaddingsToImageNative()
- FileCommited::resizeImage in vendor/
edsdk/ file-uploader-server-php/ src/ lib/ file/ FileCommited.php
File
- vendor/
edsdk/ file-uploader-server-php/ src/ lib/ file/ FileCommited.php, line 256
Class
Namespace
EdSDK\FileUploaderServer\lib\fileCode
private function addPaddingsToImageNative($image, $scaleW, $scaleH, $scaleWWithPadding, $scaleHWithPadding) {
$imageWithPaddings = imagecreatetruecolor($scaleWWithPadding, $scaleHWithPadding);
imagesavealpha($imageWithPaddings, true);
if (!FileCommited::isTransparent($image)) {
$bgColor = imagecolorallocate($imageWithPaddings, 255, 255, 255);
}
else {
$bgColor = imagecolorallocatealpha($imageWithPaddings, 0, 0, 0, 127);
}
imagefill($imageWithPaddings, 0, 0, $bgColor);
$left = floor(($scaleWWithPadding - $scaleW) / 2.0);
$top = floor(($scaleHWithPadding - $scaleH) / 2.0);
imagecopy($imageWithPaddings, $image, $left, $top, 0, 0, imagesx($image), imagesy($image));
return $imageWithPaddings;
}