Gmagick::scaleimage

(PECL gmagick >= Unknown)

Gmagick::scaleimageScales the size of an image

Описание

public Gmagick Gmagick::scaleimage ( int $width , int $height [, bool $fit = false ] )

Scales the size of an image to the given dimensions. The other parameter will be calculated if 0 is passed as either param.

Список параметров

width

The number of columns in the scaled image.

height

The number of rows in the scaled image.

Возвращаемые значения

The Gmagick object on success.

Ошибки

Вызывает GmagickException при ошибке.

Коментарии

Simple method to load an image from file, resize and display without writing to disk.
tested on jpg, gif and bmp
<?php
$image
= new Gmagick"yourimage.jpg");
$image->scaleimage(300,0);
echo 
'img src="data:image/jpeg:base64,'.base64_encode($image).'">';
$image->destroy();
?>
2019-12-07 04:32:46
http://php5.kiev.ua/manual/ru/gmagick.scaleimage.html
CORRECTION

Replace

echo 'img src="data:image/jpeg:base64,'.base64_encode($image).'">';

With 

echo '<img src="data:image/jpeg:base64,'.base64_encode($image).'">';
2019-12-07 04:52:25
http://php5.kiev.ua/manual/ru/gmagick.scaleimage.html
Its important to understand that the boolean flag : $FIT is used as a MAXIMUM boundary of either X or Y

If you use a physical image with a size of 128x256
 
 scaleImage(200, 100, true);  Will scale Y to 100 and X will be calculated
 scaleImage(100, 120, true);  Will scale X to 100 and Y will be calculated

$FIT is a LIMITER which is why it requires both an X and a Y for $FIT=true
2022-12-26 11:45:47
http://php5.kiev.ua/manual/ru/gmagick.scaleimage.html

    Поддержать сайт на родительском проекте КГБ