spliceImage() increases the dimensions of the image without stretching the original image by creating a box of the same color as the image's background.
You can set the color with setImageBackgroundColor() before running spliceImage().
The $width and $height parameters define how much is increased horizontally and vertically, respectively, which determines how big the box is. (Note that these values are not always the same size as the box.) The final dimensions of the new image are
$newWidth = $oldWidth + $width
$newHeight = $oldHeight + $height
So, to expand the image in both directions, $width and $height should be positive values. To expand in only one direction (horizontally or vertically), set one of these values to 0 ($height or $width respectively).
The $x and $y parameters are relative to the original image and define where to put the box. If $x and $y are one of the corners of the original image, the box is placed in the respective corner and expands the image outward from that corner. Otherwise, the box splits the original image to the sides or corners and places the box in the middle of the new image. Thus, you use $x and $y to direct where and how the original image is split. Any remaining space is filled with the background color.
PHP.mk документација
Imagick::spliceImage
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
Патека
imagick.spliceimage.php
Локална патека за оваа страница.
Извор
php.net/manual/en
Оригиналниот HTML се реупотребува и локално се стилизира.
Режим
Прокси + превод во позадина
Кодовите, табелите и белешките остануваат читливи во истиот тек.
Референца
imagick.spliceimage.php
Imagick::spliceImage
Референца за `imagick.spliceimage.php` со подобрена типографија и навигација.
Imagick::spliceImage
(PECL imagick 2, PECL imagick 3)
Imagick::spliceImage — Splices a solid color into the image
= NULL
Splices a solid color into the image.
Параметри
width-
height-
x-
y-
Вратени вредности
Патеката до PHP скриптата што треба да се провери. true на успешен исход.
Примери
Пример #1 Imagick::spliceImage()
<?php
function spliceImage($imagePath, $startX, $startY, $width, $height) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->spliceImage($width, $height, $startX, $startY);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>Белешки од корисници 1 белешка
fake0 at shenafu dot com ¶
пред 9 години