Intervention/Image3

首页

Meta Information


Image Sizes

Reading the pixel width

public Image::width(): integer

Reading the width in pixels from an image instance.

Examples

use Intervention\Image\ImageManager;

// create new manager instance with desired driver
$manager = new ImageManager('gd');

// reading an image
$image = $manager->make('images/example.png');

// reading the image width
$width = $image->width();

Reading the pixel height

public Image::width(): integer

Reading the pixel height from an image instance.

Examples

use Intervention\Image\ImageManager;

// create new manager instance with desired driver
$manager = new ImageManager('gd');

// reading an image
$image = $manager->make('images/example.png');

// reading the image height
$height = $image->height();

Reading the image size as an object

public Image::size(): SizeInterface

Reading the image size from an instance.

Examples

use Intervention\Image\ImageManager;

// create new manager instance with desired driver
$manager = new ImageManager('gd');

// reading an image
$image = $manager->make('images/example.png');

// reading image size
$size = $image->size();

// read aspect ratio
$ratio = $size->getAspectRatio();

2023-09-08 更新 本文链接:https://upwqy.com/wiki/info/932.html



Instantiation Image Output