Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Convert images to .webp
jakob wrote #336709:
I understand the problem. I fiddled a lot to get it work cleanly under
.txp-edit-actions– all variants there involve negating some of the effects of the flex-box and margins. With.txp-actions(no edit), there’s no separator line but that’s tolerable, and the links don’t run into each other. Thank you for that pointer. That’s now also included in the revised installer above.
Thank you, I’ll check later.
BTW: do you think there’s an argument for including a selection of basic utility classes in textpattern.css from 4.9 onwards, so that one can achieve tweaks without resorting to inline style attributes? As you rightly point out, the latter will potentially be blocked by CSP settings?
There are already some widgets or building blocks in core that plugins can reuse (.txp-edit-actions …). There is a lack of documentation, possibly some poor naming and possibly some poor styling. It could probably be useful to expand that, plugin authors should speak up here.
As for the styling for those building blocks is it not what the default theme is for1? Up to alternate theme authors to support that. I absolutely don’t see the use for a separate stylesheet for some “core widgets / utility classes / …”.
–^–
1 Unfortunately, it does not help much if the default theme is poorly or not-at-all maintained.
Last edited by phiw13 (2024-02-20 05:26:17)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#32 2024-02-22 11:34:57
- Myusername
- Member
- Registered: 2019-12-12
- Posts: 165
Re: Convert images to .webp
I developed this small plugin, and it automates the entire process of generating and deleting webp images. It can convert both images and thumbnails, whether they are generated automatically(if there’s already a width or height size defined in the prefs) or manually through the create button; it can also generate a webp image if you upload a thumbnail different from the original image directly through the upload button. I tried to consider all possibilities, but I might have missed something. I’m also not great at handling errors, so please excuse the quality of the code, and feel free to tweak and improve it if you’d like.
I attempted to pay attention to gif format images, but I really couldn’t figure out why they weren’t being converted, so I just ignored the existence of .gif images.
Last edited by Myusername (2024-02-22 11:39:27)
Offline
Re: Convert images to .webp
Myusername wrote #336720:
I developed this small plugin, and it automates the entire process of generating and deleting webp images. It can convert both images and thumbnails, whether they are generated automatically(if there’s already a width or height size defined in the prefs) or manually through the create button.
Thank you for developing this. I’ll try it out as soon as I can, but it looks like it does what you originally wanted and automatically adds webp files where available.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Convert images to .webp
For your interest, if you are using this plugin with TXP 4.9 onward, in conjunction with Julian’s advice (PHP 8.x support, see here), I noticed an error message: Warning "Undefined variable $cta_button".
Because the $cat_button variable isn’t set.
Add this line into the code (after $thumb_exists):
$thumb_exists = file_exists($webp["thumbnail"]);
$cta_button = null;
Plugin version can be found here: https://forum.textpattern.com/viewtopic.php?pid=336703#p336703.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline