-
Notifications
You must be signed in to change notification settings - Fork 68
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
ENH Allow devs to define support for third-party intervention drivers #610
ENH Allow devs to define support for third-party intervention drivers #610
Conversation
// If the driver is somehow not GD or Imagick, we have no way to know what it might support | ||
if ($driver !== 'gd' && $driver !== 'imagick') { | ||
$supported = false; | ||
$this->extend('updateSupportedByIntervention', $supported, $driver); | ||
return $supported; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there's no legitimate use case for updating the value or $supported
if the driver is gd or imagick, since the logic below exactly mirrors the logic those drivers use internally.
f402de8
to
1703ff5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads a little non standard, seems like it should something more like
$supportedDrivers = ['gd', 'imagick'];
$this->extend('updateSupportedByIntervention', $supportedDrivers);
if (!in_array($driver, $supportedDrivers)) {
return false;
}
// If the driver is somehow not GD or Imagick, we have no way to know what it might support | ||
if ($driver !== 'gd' && $driver !== 'imagick') { | ||
$supported = false; | ||
$this->extend('updateSupportedByIntervention', $format, $supported, $driver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->extend('updateSupportedByIntervention', $format, $supported, $driver); | |
$this->extend('updateSupportedByIntervention', $supported, $format, $driver); |
Change around the params to make it a little more intentful what this is for
We're updated $supported so I think it needs to be the first param as in convention
I think $format is probably next important because it most cases there's probably only one third party library, so won't need to if/else it, so it's less important that $format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of params for extension hooks isn't mentioned in our coding conventions... maybe it should be?
In this case I don't have any problem changing this order so I'll do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
1703ff5
to
e63a581
Compare
Provides an extension hook for defining which file types are supported for file conversions with third-party intervention/image drivers.
Issue
InterventionImageFileConverter
with third-party image drivers #609