Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables the GD support for resolution options group for PHP 7 >= 7.2, PHP 8.0. #813

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

gutocf
Copy link

@gutocf gutocf commented Dec 15, 2021

Example:

<?php

use Imagine\Image\ImageInterface;

$imagine = new Imagine\Gd\Imagine();

$options = array(
    'resolution-units' => ImageInterface::RESOLUTION_PIXELSPERINCH,
    'resolution-x' => 300,
    'resolution-y' => 300,
);

$imagine->open('/path/to/image.jpg')->save('/path/to/image.jpg', $options);

Copy link
Contributor

@ausi ausi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the coding style, this looks great! ❤️

src/Gd/Image.php Outdated Show resolved Hide resolved
Apply correct code style.

Co-authored-by: Martin Auswöger <martin@auswoeger.com>
@bartthys
Copy link

bartthys commented Feb 1, 2024

Hi @gutocf @ausi I'm looking for exactly this feature, I see the PR was approved but it was never merged?

@ausi
Copy link
Contributor

ausi commented Feb 1, 2024

@bartthys I’m not a maintainer of this repository, so my approval has no “official” meaning ☺️

@ausi
Copy link
Contributor

ausi commented Feb 1, 2024

In the meantime you can workaround that by using something like this in your code:

if ($yourImage instanceof \Imagine\Gd\Image) {
	imageresolution($yourImage->getGdResource(), $resolutionXppi, $resolutionYppi);
}

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

Successfully merging this pull request may close these issues.

None yet

3 participants