Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2020-02-20 21:31:20

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,258
Website

Re: Custom thumbnail output

WebP image format

The Browsers that don’t support WebP are:

  • IE – still in use by 1.55%
  • Safari 13 – 2.65%
  • iOS Safari/Chrome – 13.3%

And some more discussion on this page for the WebP Express Wordpress Plugin

Offline

#12 2020-02-21 10:50:41

gaekwad
Admin
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 2,786

Re: Custom thumbnail output

Bloke wrote #321822:

Piece of cake to add. 4.8.0? 4.8.1?

4.8.1 or later. The infamous Feature Creep Police are watching this thread, Bloke…

Offline

#13 2020-02-21 11:48:25

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,918
Website

Re: Custom thumbnail output

gaekwad wrote #321830:

The infamous Feature Creep Police are watching this thread, Bloke…

Comrade gaekwad, we are Present!

Offline

#14 2020-02-21 12:01:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,131
Website

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

#15 2020-02-21 17:45:30

gaekwad
Admin
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 2,786

Re: Custom thumbnail output

phiw13 wrote #321834:

Comrade gaekwad, we are Present!

I love the smell of Communism in the morning.

Offline

#16 2020-02-21 20:18:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,776
Website

Re: Custom thumbnail output

gaekwad wrote #321842:

I love the smell of Communism in the morning.

+1


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
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

#18 2020-02-23 20:55:19

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,764
Website

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

Board footer

Powered by FluxBB