The Wayback Machine - https://web.archive.org/web/20201026223953/https://github.com/Intervention/image/pull/959
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image resolution support (ppi). #959

Open
wants to merge 6 commits into
base: master
from

Conversation

@LastDragon-ru
Copy link

@LastDragon-ru LastDragon-ru commented Jul 3, 2019

This PR adds initial support to get and set the resolution of images for GD and Imagick, also it supports two resolutions units: ppi and ppcm (please see notes below).

Methods

  • getResolution(): Resolution
  • setResolution(\Intervention\Image\Resolution $resolution)
  • setResolution(int $xy)
  • setResolution(int $x, int $y)
  • setResolution(int $xy, string $units)
  • setResolution(int $x, int $y, string $units)

Notes

  1. Tested on PHP 7.2, on 7.1 should work too, 7.0 (fixed and supported now) and below are officially dead and I don't see any reason to support them 馃槃 especially because the gd:imageresolution() was added in 7.2
  2. GD supports only ppi, so setResolutions(ppcm) will automatically convert ppcm into ppi (imagick will use original units)
  3. While processing images (and even after make()) GD will lose original resolution 馃槥 technically this can be fixed too but requires a lot of work and will not be included in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can鈥檛 perform that action at this time.