-
Notifications
You must be signed in to change notification settings - Fork 21
Webp-Express and Crop-thumbnails #48
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
Comments
Hi @bonakor thank you for give me a note about this. |
Yeah, I agree! Thanks for having a look. |
I think, indeed, it's solved, but the remaining issue is that cropthumbnail doesn't clean the cached webp image. |
Its not an good idea for crop-thumbnails to clean the cache of another plugin. The other image needs to be notified that a change has happend. I will have a look into that. |
For anyone that is looking for a quick fix: As it depends on the configuration of WebPExpress where webp images are saved it's hard to delete the webp file. However, you can trigger a 'manual' conversion of the newly created crop. class Hooks
{
public function __construct()
{
$this->actions();
}
public function actions()
{
add_action('crop_thumbnails_after_save_new_thumb', [$this, 'convert_webp_for_new_crop'], 100);
}
/**
* Trigger new Webp conversion for new image crop.
*/
public function convert_webp_for_new_crop($new_crop)
{
if (class_exists(\WebPExpress\Convert::class)) {
// convertFile internally loads the config of WebPExpress and converts the specified file.
// we can can call this method because at 'crop_thumbnails_after_save_new_thumb' the new crop is already saved to uploads.
\WebPExpress\Convert::convertFile($new_crop);
}
}
} For us it does exactly what we want: update the webp file of a newly cropped image :) |
@phscam this works for us, thanks! I think this is a solution which can be integrated into @vollyimnetz great plugin. |
I am currently filled up with work, but thanks for the reminder. As this change is not invasive, i will like to add the code. I will notify here once i integrated it in the code. |
Will be in 1.5.0 |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Someone in the Support page of WebpExpress proposed to add these line to /save.php, to make it compatible with WebP.
if(file_exists($currentFilePath . “.webp”)){ unlink($currentFilePath . “.webp”); }
after line 73 of the save.phpI wanted to know what you think and if you had maybe a better idea to make your plugin compatible with WebP-Express.
Thank you :)
The text was updated successfully, but these errors were encountered: