Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#265 Yesterday 21:55:19
Offline
#266 Yesterday 22:41:38
Re: Automatic thumbnails for Textpattern
etc wrote #341863:
Must be consistent now, please test.
Nice consolidation and sooo close! A few questions:
How do we output custom thumbs at their natural (database) thumb_w + thumb_h? That was done before by omitting width and height (umm, I think, can’t remember). It always seems to use the fallbacks now, afaict.
What does valueless width and/or height do now? What should it do? Ditto width="" – did that ever do anything? Does it do something now?
Can we still use width="0" / height="0" to omit the value from the tag?
Can you check what happens if a thumb doesn’t exist? Previously, if a thumb didn’t exist for whatever reason, it didn’t output anything. Now it outputs an empty <img src="" alt=""> tag. Try downloading the extra large sample image and upload that 15MB monster. Txp fails to make a thumb of it (out of memory error in SLIR). If you add that ID as one of your Article Image fields, my expectation would be for it to not render the thumbnail… umm, right? Or is it better to show that it’s broken, like you have now, by outputting an empty rectangle?
I’ve not gone through all the differences yet. Those were the most obvious ones.
Last edited by Bloke (Yesterday 22:44:59)
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
#267 Yesterday 22:58:28
Re: Automatic thumbnails for Textpattern
Bloke wrote #341864:
How do we output custom thumbs at their natural (database) thumb_w + thumb_h? That was done before by omitting
widthandheight(umm, I think, can’t remember). It always seems to use the fallbacks now, afaict.
<txp:article_image thumbnail />
<!-- Ah, wait -->
What does valueless
widthand/orheightdo now? What should it do? Dittowidth=""– did that ever do anything? Does it do something now?
Valueless width/height preserves the natural dimensions, if you ever need it:
<txp:article_image height="200" width />
Without width, the width would be omitted. That’s different from 4.8, where you need to set width="0" to omit it, but I can not see why anyone would like to deform an image.
Can we still use
width="0"/height="0"to omit the value from the tag?
Yes, but it will be omitted by default anyway if some other transform is set.
TBC
Offline
#268 Yesterday 23:10:24
Re: Automatic thumbnails for Textpattern
Bloke wrote #341864:
Can you check what happens if a thumb doesn’t exist? Previously, if a thumb didn’t exist for whatever reason, it didn’t output anything. Now it outputs an empty
<img src="" alt="">tag. Try downloading the extra large sample image and upload that 15MB monster. Txp fails to make a thumb of it (out of memory error in SLIR). If you add that ID as one of your Article Image fields, my expectation would be for it to not render the thumbnail… umm, right? Or is it better to show that it’s broken, like you have now, by outputting an empty rectangle?
You mean auto thumbnails? The tag has no means to check whether txp has failed to make a thumbnail or never tried. Previously, if you called
<txp:article_image thumbnail=1" />
the tag loaded only images with thumbnail="1" in the db, but never checked whether 123t.jpg really exists.
Offline
#269 Yesterday 23:10:34
Re: Automatic thumbnails for Textpattern
etc wrote #341865:
Valueless
width/heightpreserves the natural dimensions, if you ever need it
Perfect. That’s what I expect it should do, thank you. I was just checking, cos my test tags are a mess and my brain’s fried.
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
#270 Yesterday 23:13:45
Re: Automatic thumbnails for Textpattern
etc wrote #341866:
You mean auto thumbnails?
Well, either I guess.
But yes you’re right, if the thumb can’t be created on the admin side, it won’t be able to be created on the public site either, so it’ll just fail when SLIR is invoked. So yeah, that’s fine. We’ll take the hit on it outputting a blank tag. Totally cool.
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
#271 Yesterday 23:17:47
Offline
#272 Today 00:36:41
Re: Automatic thumbnails for Textpattern
A few tests so far between article_image and image (wrapped with <txp:images>) yields:
Full size images, both render fine.
<txp:article_image />
<img src="https://example.com/images/210.webp" alt="" width="5760" height="3840">
<txp:image />
<img src="https://example.com/images/210.webp" alt="">
Article image fine, regular image too small to see. I would expect the image tag to use the full DB width.
<txp:article_image width />
<img src="https://example.com/images/210.webp" alt="" width="5760">
<txp:image width />
<img src="https://example.com/images/210.webp" alt="" width="1">
Ditto, with DB width and height used for image tag.
<txp:article_image width height />
<img src="https://example.com/images/210.webp" alt="" width="5760" height="3840">
<txp:image width height />
<img src="https://example.com/images/210.webp" alt="" width="1" height="1">
Full size, because no dimensions are used.
<txp:article_image crop />
<img src="https://example.com/images/210.webp" alt="">
<txp:image crop />
<img src="https://example.com/images/210.webp" alt="">
Full size, no dimensions. Fine.
<txp:article_image width="0" />
<img src="https://example.com/images/210.webp" alt="">
<txp:image width="0" />
<img src="https://example.com/images/210.webp" alt="">
Expected.
<txp:article_image width="0" height />
<img src="https://example.com/images/210.webp" alt="" height="3840">
<txp:image width="0" height />
<img src="https://example.com/images/210.webp" alt="" height="1">
Article thumb defaults to fallback sizes. Regular thumb uses 't' (custom).
<txp:article_image thumbnail />
<img src="https://example.com/images/210.webp" alt="" width="160" height="160">
<txp:image thumbnail />
<img src="https://example.com/images/210t.webp" alt="">
Article image cannot be rendered (out of memory). Regular image too small to see.
<txp:article_image thumbnail width />
<img src="https://example.com/images/thumb/w5760/210.webp?token=56e0c6e2..." alt="" width="5760">
<txp:image thumbnail width />
<img src="https://example.com/images/thumb/w1/210.webp" alt="" width="1">
Ditto.
<txp:article_image thumbnail width height />
<img src="https://example.com/images/thumb/w5760-h3840/210.webp?token=7b25fec4f..." alt="" width="5760" height="3840">
<txp:image thumbnail width height />
<img src="https://example.com/images/thumb/w1-h1/210.webp" alt="" width="1" height="1">
Fine.
<txp:article_image thumbnail width="300" />
<img src="https://example.com/images/thumb/w300/210.webp?token=7db2a7abc..." alt="" width="300">
<txp:image thumbnail width="300" />
<img src="https://example.com/images/thumb/w300/210.webp?token=7db2a7abc..." alt="" width="300">
Article image fine. Regular image is a solid rectangle of colour. Different tokens (as expected).
<txp:article_image thumbnail width="300" height />
<img src="https://example.com/images/thumb/w300-h3840/210.webp?token=8d8541c72..." alt="" width="300" height="3840">
<txp:image thumbnail width="300" height />
<img src="https://example.com/images/thumb/w300-h1/210.webp?token=0bedbcfa1c..." alt="" width="300" height="1">
Fine.
<txp:article_image thumbnail width="300" height="240" />
<img src="https://example.com/images/thumb/w300-h240/210.webp?token=44102bac..." alt="" width="300" height="240">
<txp:image thumbnail width="300" height="240" />
<img src="https://example.com/images/thumb/w300-h240/210.webp?token=44102bac..." alt="" width="300" height="240">
Fine.
<txp:article_image thumbnail width="300" height="240" crop="1x1.smart" />
<img src="https://example.com/images/thumb/w300-h240-c1x1.smart/210.webp?token=ee4e683..." alt="" width="300" height="240">
<txp:image thumbnail width="300" height="240" crop="1x1.smart" />
<img src="https://example.com/images/thumb/w300-h240-c1x1.smart/210.webp?token=ee4e683..." alt="" width="300" height="240">
Fine.
<txp:article_image thumbnail crop="1x1.smart" />
<img src="https://example.com/images/thumb/c1x1.smart/210.webp?token=5bf6d32..." alt="">
<txp:image thumbnail crop="1x1.smart" />
<img src="https://example.com/images/thumb/c1x1.smart/210.webp?token=5bf6d32..." alt="">
Renders nothing if no custom thumb (as expected).
<txp:article_image thumbnail="1" width="300" height />
<img src="https://example.com/images/210t.webp" alt="" width="300" height="160">
<txp:image thumbnail="1" width="300" height />
<img src="https://example.com/images/210t.webp" alt="" width="300" height="1">
Ditto.
<txp:article_image thumbnail="1" width="300" height="240" />
<img src="https://example.com/images/210t.webp" alt="" width="300" height="240">
<txp:image thumbnail="1" width="300" height="240" />
<img src="https://example.com/images/210t.webp" alt="" width="300" height="240">
Fine.
<txp:article_image thumbnail="2" width="300" height="240" />
<img src="https://example.com/images/thumb/w300-h240/210.webp" alt="" width="300" height="240">
<txp:image thumbnail="2" width="300" height="240" />
<img src="https://example.com/images/thumb/w300-h240/210.webp" alt="" width="300" height="240">
Fine.
<txp:article_image thumbnail="2" width="300" height="240" quality="40" />
<img src="https://example.com/images/thumb/w300-h240-q40/210.webp?token=440e9934..." alt="" width="300" height="240">
<txp:image thumbnail="2" width="300" height="240" quality="40" />
<img src="https://example.com/images/thumb/w300-h240-q40/210.webp?token=440e9934..." alt="" width="300" height="240">
Looks reasonable so far, aside from the <txp:image> (and, by inference, the <txp:image_url> tag) tag not outputting the DB dimensions when used valueless.
Are we comfortable that these are backwards-compatible enough to avoid nasty surprises in most situations, bearing in mind that many people won’t be using the attributes in these ways, because some of the combos weren’t very logical or useful before?
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
#273 Today 11:52:02
Offline
#274 Today 12:02:25
Re: Automatic thumbnails for Textpattern
Yeah, on it.
I’m tempted to add in valueless width/height to the main <txp:image(_url) tags so they use the DB values, and just run with it. We should be doing that for valueless attributes anyway and it doesn’t have any b/c issues since we don’t support it in 4.8.8. and below.
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