Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Custom thumbnail output
gaekwad wrote #321830:
The
infamousFeature Creep Police are watching this thread, Bloke…
Comrade gaekwad, we are Present!
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Custom thumbnail output
Hehe, it won’t be 4.8.0. Gave it a quick test in a separate branch and it works, but there are issues with creating thumbnails with transparency in WebP, so we can do this later.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Custom thumbnail output
phiw13 wrote #321834:
Comrade gaekwad, we are Present!
I love the smell of Communism in the morning.
Offline
Re: Custom thumbnail output
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#17 2020-02-23 20:17:19
- tka
- New Member
- Registered: 2010-02-15
- Posts: 4
Re: Custom thumbnail output
Wow, didn’t expect to kick some discussion like this off. ;)
colak wrote #321820:
You can then call this form in your template by using
<txp:output_form form="webp" />
or whatever else you may have called your form.
Thanks a bunch. Sounds like an excellent solution. Unfortunately it is not working in my case. I tested and it seems the processing steps right over the <txp:if_variable>
(never enters the statement). So mabe, the txp:variable is not true in my case?
Btw: I am currently using v4.8.0-beta.2 – so maybe that’s a clue…
Offline
Re: Custom thumbnail output
A
tka wrote #321857:
Unfortunately it is not working in my case. I tested and it seems the processing steps right over the
<txp:if_variable>
(never enters the statement).
Ah, there’s a mistake in the code above. You have to test for the variable colak’s called ai
so it should read <txp:if_variable name="ai"> …
like so:
<txp:variable name="ai"><txp:custom_field name="article_image" /></txp:variable>
<txp:if_variable name="ai">
<picture>
<source srcset="/webp/<txp:variable name="ai" />.webp" type="image/webp">
<source srcset="/images/<txp:variable name="ai" />.jpg" type="image/jpeg">
<img src="/images/<txp:variable name="ai" />.jpg">
</picture>
</txp:if_variable>
The other provisos are that you have an image ID# entered in your article’s article image field and you have a webp image with the same {number}.webp
filename in a separate /webp/
folder.
TXP Builders – finely-crafted code, design and txp
Offline
#19 2020-02-23 21:14:37
- tka
- New Member
- Registered: 2010-02-15
- Posts: 4
Re: Custom thumbnail output
Thanks, jakob. With the little tweak it works perfectly. :)
Seems like I can reduce my frontpage by about 200 KB with webp (for some users). Not much, but I guess some folks on mobile and limited data will enjoy.
Offline