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

Croppa::render() not working due to PATTERN issue in the URL class. #189

Open
Don404 opened this issue May 7, 2020 · 2 comments
Open

Croppa::render() not working due to PATTERN issue in the URL class. #189

Don404 opened this issue May 7, 2020 · 2 comments

Comments

@Don404
Copy link

Don404 commented May 7, 2020

Croppa::render() was not working and was returning false. I traced the problem to the parse function in the URL class. The issue was the const PATTERN. I deleted the last character and from this:

const PATTERN = '(.+)-([0-9_]+)x([0-9_]+)(-[0-9a-zA-Z(),\-._]+)*\.(jpg|jpeg|png|gif|JPG|JPEG|PNG|GIF)$';

became

const PATTERN = '(.+)-([0-9_]+)x([0-9_]+)(-[0-9a-zA-Z(),\-._]+)*\.(jpg|jpeg|png|gif|JPG|JPEG|PNG|GIF)';

and now works like a charm.

@Don404 Don404 changed the title Croppa::render() not working due to PATTERN issue with last character. Croppa::render() not working due to PATTERN issue in the URL class. May 7, 2020
@weotch
Copy link
Member

weotch commented May 8, 2020

Do you have extra characters after your file extension?

@Don404
Copy link
Author

Don404 commented May 8, 2020

That dollar sign at the end of the pattern caused some kind of problem and if (!preg_match('#'.self::PATTERN.'#', $request, $matches)) return false; was returning always false. After I removed the $ the issue was fixed and the preg_match was matching everything as expected.

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