Width, height and wh (width-height)
You can specify the width and the height of an image in pixels. This operation is influenced by crop
, that may keep the aspect ratio of the image.
Aliases
width
->w
height
->h
Parameters
- 1 or higher integer [px]
Limitations
- the maximum width and height is 10000 px
- the minimum value is 1 px
Dependencies
Examples
Set the image width to 100 px.
w:100
or
width:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->width(100);
Set the image height to 100 px.
h:100
or
height:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->height(100);
Set the image height to 200 px and the width to 100 px.
h:200_w:100
or
height:200_width:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->height(200)->width(100);
Both create a 100x100px image.
wh:100
or
w:100_h:100
use shardimage\shardimagephp\factories\Transformation;
$transformations = (new Transformation())->size(100);
// is equivalent to
$transformations = (new Transformation())->height(100)->width(100);