Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#217 Yesterday 22:18:07
Re: Automatic thumbnails for Textpattern
Sorry, I meant now tokens are always used, even for existing thumbnails.
- Pros: generated thumbnails are put in browsers cache immediately and used on further access, since their URL remains the same.
- Cons: when the secret key is changed, URLs change too, so the browser has to download (from disk) the thumbnails again, even if they are already cached.
Dunno which is better. Probably, we could send a 301 redirect to the canonical tokenless URL?
Offline
#218 Yesterday 22:58:29
Re: Automatic thumbnails for Textpattern
Ah okay. hash_hmac() works and is better than faffing with the Token class, imo, and harder to hack than crypt().
I’ll run some tests in a few mins but that seems like a good compromise to me.
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
#219 Yesterday 23:31:17
Re: Automatic thumbnails for Textpattern
Meanwhile I have reverted existing thumbnails to tokenless URLs. If you want, try adding
global $img_dir;
set_headers(array(1=>301,"Location" => ihu.$img_dir.'/'.TEXTPATTERN_THUMB_DIR.$this->renderedCacheFilename()));
exit;
after l.1450 of SLIR.php. The idea is, once the thumbnail generated, redirect the request to its tokenless URL. This way, the thumbnail is not cached as its temporary URL, but directly as its tokenless URL.
Offline
#220 Yesterday 23:43:25
Re: Automatic thumbnails for Textpattern
Yeah, that totally works for me. I like it. Fast. Predictable. Secure. Ticks all the boxes. Nice work, thank you.
And thanks to everyone who has indulged me these past few weeks with testing and ideas and code and pointers as we turn my crazy last-minute idea into something I hope will be of huge benefit to the Txp community.
I’ve been mulling this over for months and months, trying stuff, rejecting it, trying something else, trying it as a plugin, etc etc. My original reticence at bringing this to core was because I couldn’t figure how to offer both the auto-thumb generation and changing the tags to support regular images, srcsets, art direction and so forth.
Then it hit me: why bother doing everything? The tags are flexible enough to DIY, so just provide the engine and let site admins use the tags to build the bodywork. And here we are.
Let the last minute testing commence! Not just this feature, but everything you can, please. New installs, upgrades, SMTP features, future and ancient content dates, UI library, as many tag features as you can, user management, plugins, whatever you can lay your hands on would be of immense benefit.
Then let’s lock the branch tomorrow night and pull the chocks to launch this magnificence.
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
#221 Yesterday 23:44:49
Re: Automatic thumbnails for Textpattern
etc wrote #341809:
The idea is, once the thumbnail generated, redirect the request to its tokenless URL. This way, the thumbnail is not cached as its temporary URL, but directly as its tokenless URL.
Neat idea. I’ll add that now and see what happens.
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
#222 Today 00:00:48
Re: Automatic thumbnails for Textpattern
Okay, that works fine on a server but borks on localhost. Like, it sits there for 5 seconds or so with a broken/empty image placeholder space and then, eventually, the 301 redirects and the content loads. No idea why.
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
#223 Today 00:09:38
Re: Automatic thumbnails for Textpattern
I’ve just tried clearing caches and the contents of the thumbs folder, then reloading. The very first time I got some dropped out images but the images were generated. I couldn’t see why they weren’t appearing. But I haven’t been able to provoke that into happening again, logged-in or not, with completed cleared browser cache and folder, with a new browser. Seems to work just fine on localhost. The tokens for identical sized images also match.
User passwords, activation links, password resets work in quick local testing too. I can do more testing tomorrow…
TXP Builders – finely-crafted code, design and txp
Offline
#224 Today 00:24:19
Re: Automatic thumbnails for Textpattern
Okay, thank you. Tell you what, I’ll commit this 301 redirect change and see what the fallout is. We can always revert in the morning.
It appears I’m not alone with the 5-second thing…
Gimma a few mins to commit it.
EDIT: Done
Last edited by Bloke (Today 00:28:09)
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
#225 Today 00:48:23
Re: Automatic thumbnails for Textpattern
The image handling is still working fine here, and it feels blazing fast. Tested with all /images/thumb/* folders removed and the browser caches et tutti quanti cleared.
I do not see the localhost delay so far.
Great work with this.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#226 Today 06:29:48
Re: Automatic thumbnails for Textpattern
This might an edge case.
I have that ~20years old digital camera (Canon Powershot SX 130) which still takes nice pictures. Images are displayed correctly, e.g. as ‘portrait’ mode in the Finder, in macOS apps (Preview, Acorn) and in Textpattern. Here is one odd thing: when I upload one of those images, the width and height dimensions (and the equivalent <txp:image_info type='w' />, etc) are given as if in landscape mode – always 4000px by 3000px. The “orientation” meta data is given as “8” or 270º CW rotation. The thumbnail is created correctly.
It is enough that I open the image in Acorn and save as again to set everything right. That is something I do anyway, I never upload that large size images cluttering file-system on the server.
The issue is not new. I verified it existed in Textpattern 4.9 beta 2.
Sample image here: dev.l-c-n.com/_b/IMG_4658.JPG
(complete with erroneous created date as the camera refuses to remember her date settings)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#227 Today 06:52:33
Re: Automatic thumbnails for Textpattern
phiw13 wrote #341820:
Sample image here: dev.l-c-n.com/_b/IMG_4658.JPG
(complete with erroneous created date as the camera refuses to remember her date settings)
I get a Forbidden. You don’t have permission to access this resource error.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#228 Today 07:00:19
Re: Automatic thumbnails for Textpattern
colak wrote #341821:
I get a Forbidden. You don’t have permission to access this resource error.
Oops, thanks for warning. for some reason the image uploaded with permission 0600 instead of 0644. Corrected that it should be accessible now.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline