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

Vertical bigger image issue #325

Closed
hbabuc opened this issue May 23, 2017 · 2 comments
Closed

Vertical bigger image issue #325

hbabuc opened this issue May 23, 2017 · 2 comments

Comments

@hbabuc
Copy link

hbabuc commented May 23, 2017

hi, firstly this plugin is awesome, but we found an issue;
screenshot_20170523-183210
screenshot_20170523-183227

when we select a vertical bigger image on top, there is no issue but;

screenshot_20170523-183214
screenshot_20170523-183239

when we selected vertical bigger image on bottom, there will be a black box in the output image.
I hope i can tell you the issue exactly. In the horizontal bigger images, there is no problem.

Thank you.

@patrickng
Copy link
Contributor

patrickng commented May 23, 2017

I see this issue as well. I think it's related to #247 and #318. The problem seems to be that when the code

            if (left < 0) {
                startX = Math.abs(left);
                left = 0;
            }
            if (top < 0) {
                startY = Math.abs(top);
                top = 0;
            }
            if (right > self._originalImageWidth) {
                width = self._originalImageWidth - left;
                outWidth = width;
            }
            if (bottom > self._originalImageHeight) {
                height = self._originalImageHeight - top;
                outHeight = height;
            }

is not properly enclosed by a conditional that checks if (!self.options.enforceBoundary) according to the comment on line 982 (// start fixing data to send to draw image for enforceBoundary: false)

That bit of code seems to not be necessary if you did not specify enforceBoundary: false in the options.

If that bit of code was changed to:

        // start fixing data to send to draw image for enforceBoundary: false
        if (!self.options.enforceBoundary) {
            if (left < 0) {
                startX = Math.abs(left);
                left = 0;
            }
            if (top < 0) {
                startY = Math.abs(top);
                top = 0;
            }
            if (right > self._originalImageWidth) {
                width = self._originalImageWidth - left;
                outWidth = width;
            }
            if (bottom > self._originalImageHeight) {
                height = self._originalImageHeight - top;
                outHeight = height;
            }
        }

then it seems to work just fine.

@hbabuc
Copy link
Author

hbabuc commented May 24, 2017

ohh thank you, it worked really well. you just saved me a lot of work 👍

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

3 participants