Skip to content

Define a maximum resize #10

Description

@w-jerome

It happens that some images are not very wide, but they are very high, or very wide, but not very high. In this case, if we want to do a simple resizing, we can have unwanted sizes.

Example:

$image = new Imagine('./my-picture.jpg'); // width: 100px - height: 500px
$image->setWidth(300);
$image->save('./my-picture-bigger.jpg'); // width: 300px - height: 1500px

In some cases, you may not want to exceed a certain limit, depending on disk space constraints or on the choice of the artistic direction. It should be possible to limit this.

Possibility to study:

$image = new Imagine('./my-picture.jpg'); // width: 100px - height: 500px
$image->setWidth(750);
$image->setHeight(750);
$image->setIsMaximumSize();
$image->save('./my-picture-bigger.jpg'); // width: 150px - height: 750px

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions