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

ImageColorAt out of bounds #4

Closed
4dr1en opened this issue Aug 29, 2020 · 5 comments
Closed

ImageColorAt out of bounds #4

4dr1en opened this issue Aug 29, 2020 · 5 comments

Comments

@4dr1en
Copy link
Contributor

4dr1en commented Aug 29, 2020

Hello, I also have a problem with ImageColorAt, with images in portrait format.
This is an example of an image that makes a lot of errors "ImageColorAt out of bounds": https://imgur.com/a/7RBwF4k
I use the code in wamp (php7.3.12).
Have you found a solution to this problem?

@xwiz
Copy link
Owner

xwiz commented Aug 29, 2020

This may be a problem with php mime configuration.

Take a look at this #3 (comment)

@4dr1en
Copy link
Contributor Author

4dr1en commented Aug 29, 2020

I don't know how to configure this but I think i found a problem in makeThumbnail.

this function make too small thumbail if the image is in portrait format.
I replaced

$newheight = $thumbheight;

$divisor = $height / $thumbheight;

$newwidth = floor( $width / $divisor );

by

if($width >= $height){

            $newheight = $thumbheight;

            $divisor = $height / $thumbheight;

            $newwidth = floor( $width / $divisor );

        }

        else{

            $newwidth = $thumbwidth;

            $divisor = $width / $thumbwidth;

            $newheight = floor( $height / $divisor );

        }

And now that work for me. 👍

@xwiz
Copy link
Owner

xwiz commented Aug 29, 2020

Interesting can you share a sample problematic image? The resizing should normally be able to resize/downscale to 8 x 8 unless the images are smaller than that..

@4dr1en
Copy link
Contributor Author

4dr1en commented Aug 29, 2020

I had this issue with all images with $height > $width. Even the images with just a 90° rotation.

@xwiz
Copy link
Owner

xwiz commented Aug 29, 2020

Hmm, been long I tested, will check it out and set up a unit test... Feel free to create PR if you have tested

@xwiz xwiz closed this as completed Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants