claviska / SimpleImage

A PHP class that makes working with images and GD as simple as possible.
MIT License
1.38k stars 382 forks source link

Add instance flags #301

Closed VictorWesterlund closed 2 years ago

VictorWesterlund commented 2 years ago

Adds support for settable and gettable instance flags. This allows overrides of default behavior to be set upon instantiation of the SimpleImage class.

Only sslVerify will be implemented as of right now (from #300) but more flags can be added in the future.

Example use of flag overrides with sslVerify:

// Class initialized with image URL
$img = new claviska\SimpleImage("https://localhost/img.png", ["sslVerify" => false]);
$img->thumbnail(128,128)->toFile("thumb.png");
// Class initialized without image URL
$img = new claviska\SimpleImage(flags: ["sslVerify" => false]);
$img->fromFile("https://localhost/img.png")->thumbnail(128,128)->toFile("thumb.png");

This PR invalidates #300

TODO before merge

VictorWesterlund commented 2 years ago

@claviska please have a look at this follow-up PR from https://github.com/claviska/SimpleImage/pull/300#issuecomment-1153720576.

If everything checks out; I will add the README doc for this feature and open the PR!

claviska commented 2 years ago

Thanks for the update...this is fantastic. I only have one final concern, which I've commented on in the source. Thanks again!

VictorWesterlund commented 2 years ago

A fix for GIF transparency is pushed!