Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#253 Today 14:21:12
Re: Automatic thumbnails for Textpattern
Oleg or anyone: because I’m slightly nervous about this redirect thing, could we make it opt-out via a (hidden) pref or config.php define() that overrides a THUMB_REDIRECT constant?
I’ll add that conditional check around the redirect if nobody else gets to it before me. Then it’ll just fall through and serve the image as normal if the check is false.
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
#254 Today 16:39:47
Re: Automatic thumbnails for Textpattern
It misbehaves? Why not, but what would be the default mode?
Offline
#255 Today 16:51:46
Re: Automatic thumbnails for Textpattern
Default = true = use redirects.
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
#256 Today 16:54:04
Re: Automatic thumbnails for Textpattern
I don’t anticipate there to be a problem but just in case there’s some server config or browser out there that steadfastly refuses to play by the rules, people will get missed thumbs or white screens with no explanation. At least with a conditional constant, they can turn off the redirect behaviour and know the images will always be generated without the redirect layer getting in the way.
If we get no reports of any issues, we can deprecate the constant and remove it in a future release.
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
#257 Today 17:14:09
Re: Automatic thumbnails for Textpattern
Works for me. The values of THUMB_REDIRECT might be 0, 301, 302 etc, for extra flexibility?
Offline
#258 Today 17:17:54
Re: Automatic thumbnails for Textpattern
I did actually consider that. I think that might be even cooler. I even had random notion that its value might be the cache-control header tags so you could choose how invasive the cache should be. But figured there was probably too much to potentially go wrong.
Question: if we go with allowing a redirect value, should it silently skip any invalid value that isn’t in the 300-range? Wouldn’t want anyone serving a 500 there!
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
#259 Today 18:02:53
Re: Automatic thumbnails for Textpattern
Caveat utilitor?
I’m stuck trying to output automatic thumbnails via, say, <txp:article_image thumbnail />, which is supposed to output thumbnails (or images themselves if none) with correct height/width. The problem is, automatic thumbnails have no ‘default’ dimensions (or, rather, they are admin-theme-dependent). Dunno what would be natural candidates..?
Offline
#260 Today 18:18:59
Re: Automatic thumbnails for Textpattern
etc wrote #341857:
Caveat utilitor?
Hehe, maybe. I’ve errred on the side of caution for now.
I’m stuck trying to output automatic thumbnails via, say,
<txp:article_image thumbnail />, which is supposed to output thumbnails (or images themselves if none) with correct height/width. The problem is, automatic thumbnails have no ‘default’ dimensions (or, rather, they are admin-theme-dependent). Dunno what would be natural candidates..?
Convention.
If you specify valueless thumbnail attribute (or a specific value type 0, 1, 2) and the thumbnail type for the current image matches:
- 1, serve the NNt.ext file at the thumb_w/thumb_h. It squishes or scales (even if pixellated) if you specify your own
width/heightattributes. If you empty thewidth/heightattributes, it doesn’t output the empty dimension(s) in the tag.cropattribute does nothing. - 2, serve the full size image. Auto thumbnails MUST have a
width/height/cropor they make no sense. - 2 AND you specify a
width/height/cropattribute value, serve the auto thumbnail at those dimensions/crop.
EDIT: Or, if you feel we should use a default value for the second case, we have TEXTPATTERN_THUMB_WIDTH and TEXTPATTERN_THUMB_HEIGHT constants, which you could use as fallback? That might make more sense, maybe? They were designed for use on the admin side, but they could apply equally well to the public site as defaults.
Last edited by Bloke (Today 18:28:01)
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
#261 Today 18:35:00
Re: Automatic thumbnails for Textpattern
Sorry, I made multiple edits / addendums to the previous post :/
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
#262 Today 18:35:38
Re: Automatic thumbnails for Textpattern
Ah, great, thanks! Must be ready in an hour or two.
Offline
#263 Today 18:36:58
Re: Automatic thumbnails for Textpattern
Thank you. I don’t mind which way we play case #2. Either serve full size, or serve it thumbnailed with the constant fallback dimensions.
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
#264 Today 18:59:16
Re: Automatic thumbnails for Textpattern
Answering my own question after doing some online research, I’ve applied the sharpness filter to WebP images by default too. Seems the general feel out in webland is it’s a good idea. But not for AVIF.
I haven’t added an option to choose sharpness or not per image type. Tempted to leave it as-is for now.
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