You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to 3.0, the "Keep WordPress Thumbnails" option no longer works. I've looked around at how to fix it, and I have a fix, but I'm not sure if my fix breaks another option, so I didn't want to put in a PR.
Basically, $this->keepThumbnails is used in in DynamicImagesTool->setup() before it's set by ImgixTool->setup().
The flow goes like:
DynamicImagesTool {
setup() {
if (!$this->keepThumbnails) {
add_filter('wp_image_editors', function($editors) {
array_unshift($editors, '\ILAB\MediaCloud\Tools\DynamicImages\DynamicImageEditor');
return $editors;
});
}
}
}
ImgixTool extends DynamicImagesTool {
setup() {
parent::setup();
// keepThumbnails option is set _after_ the parent::setup(), so it's never set correctly to be used in parent::setup();
$this->keepThumbnails = Environment::Option('mcloud-imgix-generate-thumbnails', null, true);
}
}
So, the two fixes are:
In ImgixTool(), Move $this->keepThumbnails = Environment::Option('mcloud-imgix-generate-thumbnails', null, true); above parent::setup(); Or
Move the if (!$this->keepThumbnails) { ... } code from DynamicImagesTool()->setup() to after $this->keepThumbnails is set in ImgixTool()->setup().
I wasn't sure if one was better/worse than the other since I don't know the ins and outs of the plugin as well as you :) If it's easier for you, I'm happy to put in the PR for the best change if you let me know which one to go with (or some other one).
The text was updated successfully, but these errors were encountered:
After upgrading to 3.0, the "Keep WordPress Thumbnails" option no longer works. I've looked around at how to fix it, and I have a fix, but I'm not sure if my fix breaks another option, so I didn't want to put in a PR.
Basically,
$this->keepThumbnails
is used in inDynamicImagesTool->setup()
before it's set byImgixTool->setup()
.The flow goes like:
So, the two fixes are:
ImgixTool()
, Move$this->keepThumbnails = Environment::Option('mcloud-imgix-generate-thumbnails', null, true);
aboveparent::setup();
Orif (!$this->keepThumbnails) { ... }
code fromDynamicImagesTool()->setup()
to after$this->keepThumbnails
is set inImgixTool()->setup()
.I wasn't sure if one was better/worse than the other since I don't know the ins and outs of the plugin as well as you :) If it's easier for you, I'm happy to put in the PR for the best change if you let me know which one to go with (or some other one).
The text was updated successfully, but these errors were encountered: