Add curl option support in Image class#5
Merged
DantSu merged 2 commits intoDantSu:masterfrom Nov 9, 2022
Merged
Conversation
…array for things like timeouts, useragents, SSL Key checks etc. - Support fail on error for curl requests as well. The library didn't appear to have any way to bubble up a problem when the curl didn't succeed. $failOnError=true will throw an exception when there is an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm primarily using php-image-editor because I've been testing out php-osm-static-api. I noticed a couple of things that could help with crafting curl requests, and handling failures. A great example where allowing failOnError is when you want to catch a URL that either isn't resolving, or returning a status that isn't 200.
My use case would be, if one image processing instance is down, allow fail over to another by using a try catch in my code.
This pull request contains the following for the reasons stated above.
Make it so the curl features of the library support a curl options array for things like timeouts, useragents, SSL Key checks etc.
Support fail on error for curl requests as well. The library didn't appear to have any way to bubble up a problem when the curl didn't succeed. $failOnError=true will throw an exception when there is an error.