-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
PHP 8.0+ version #316
PHP 8.0+ version #316
Conversation
closes claviska#260 Signed-off-by: bnomei <[email protected]>
Signed-off-by: bnomei <[email protected]>
closes claviska#311 Signed-off-by: bnomei <[email protected]>
Signed-off-by: bnomei <[email protected]>
… .gitattributes file) Signed-off-by: bnomei <[email protected]>
Signed-off-by: bnomei <[email protected]>
Signed-off-by: bnomei <[email protected]>
Signed-off-by: bnomei <[email protected]>
Thanks for bringing the library up to speed with current PHP versions! I'm perfectly fine accepting this PR, but it's going to require a version bump to 4.0 to prevent breaking things for existing users. Before we proceed, are there any other breaking changes you think should be made? |
like you said in #284 i would also v4 mainly to upgrade php version. the api in its current state does not need changing imho - it get the job done well. |
EXIF |
FORMAT SPECIFIC OPTIONS
example: public function toString($mimeType = null, $quality = 100, $options = null)
{
return $this->generate($mimeType, $quality, $options)['data'];
}
protected function generate($mimeType = null, $quality = 100, $options = null)
{
// OTHER CODE
is_array($options) ?
imageavif($this->image, null, $quality, ...$options) :
imageavif($this->image, null, $quality);
} used like this... echo $image->toScreen('image/avif', 80, ['speed' => 8]); |
Should we also combine |
i will add a suggestion to my PR during the next few days. |
…wnwards compatible Signed-off-by: bnomei <[email protected]>
…HPStorm) Signed-off-by: bnomei <[email protected]>
@claviska updated the PR with decided that i will not work on the exif issue. feel free to release v4 without it. |
src/claviska/SimpleImage.php
Outdated
$width = $maxHeight * $this->getAspectRatio(); | ||
} else { | ||
$width = $maxWidth; | ||
$height = $maxWidth / $this->getAspectRatio(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to add round()
to this to prevent the following error:
PHP Deprecated: Implicit conversion from float 375.234521575985 to int loses precision in /Users/claviska/SimpleImage/src/claviska/SimpleImage.php on line 958
I noticed this when using bestFit()
in the example, as it was causing the image to not render. This might affect other methods in a similar way.
To replicate:
cd SimpleImage/example
php -S localhost:8080
Then a open a browser at http://localhost:8080/index.php and notice the broken image.
src/claviska/SimpleImage.php
Outdated
// Reduce to max width | ||
if ($width > $maxWidth) { | ||
$width = $maxWidth; | ||
$height = $width / $this->getAspectRatio(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to use round()
or we can accept a float in resize()
and convert it there. Your call.
I just wanted to say that this PR looks really good. I only noticed that one issue with It's been awhile, but IIRC most of the GD functions require integers so we should probably use |
sure. i can do that. |
Signed-off-by: bnomei <[email protected]>
there are lots remaining related resource/GDImage/false and since some methods return false instead of throwing an error. but I think it should be good enough for now. |
Thanks so much for this. A 4.0.0 tag has been created. |
this PR
.gitattributes
file