Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2025-12-05 09:47:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

phiw13 wrote #341515:

I would prefer separate field, it is different data after all (with px at the end?)

Howzat?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#32 2025-12-05 09:53:10

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

etc wrote #341517:

I don’t understand half of it, but this looks big.

It’s big and not big at the same time. I’ve had this in various local playgrounds and various guises for ages, including as a sort-of plugin that was going to be the successor to smd_thumbnail. But it just seemed so much extra effort for a plugin to rewire the thumbnail process (see how much wrangling smd_thumbnail has to do!) that it just made sense to roll it up and bundle it in core.

The footprint is comparatively tiny for the benefit of being able to securely output images at any size, without having to bounce back to the Edit panel and create a new profile for width, height and crop, then regenerate the images, and force those sizes on every image whether it needed it or not, whether it was SVG or not, whether it was tiny or not and exploded in a shower of jaggy pixels, and so on. SLIR takes all that away with true on-demand image creation, cacheing and garbage collection so Txp only creates the thumbnail images you need on both the back-end and public-facing site. It cuts directory bloat. Cuts admin hassle. But still retains the backwards-compatible fixed-dimension thumbnail that’s been in Txp since day 1 if you wish to use it.

Hurrying up to test.

Thank you. The big things left to check:

  1. Does it hold up on localhost as well as online?
  2. Does it work reliably with subdir installs?
  3. How does it handle Article Images (specifically com_article_image).
  4. Is it error-free when using Article Images that are URLs?
  5. Can the thumbnail creation process be triggered from a bulk upload reliably (Ajax-fu required by someone).
  6. Are there any further optimisations we can employ?

Last edited by Bloke (2025-12-05 09:59:47)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#33 2025-12-05 09:53:55

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,671
Website

Re: Automatic thumbnails for Textpattern

Bloke wrote #341518:

Howzat?

Thumbs up 👍 👍
Thanks. This can be viewed by everyone.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#34 2025-12-05 10:02:02

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,238
Website GitHub

Re: Automatic thumbnails for Textpattern

phiw13 wrote #341521:

Thumbs up 👍 👍
Thanks. This can be viewed by everyone.

Here too 👍 👍. Thanks.

My instinct is to shift it up alongside the ID to save space, but that’s easily done in a custom theme (css) with float:left and margin-inline-end on the id block in css.


TXP Builders – finely-crafted code, design and txp

Offline

#35 2025-12-05 10:21:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

jakob wrote #341522:

My instinct is to shift it up alongside the ID to save space,

Mine too. Amendments / PRs welcome if it improves things (though an ‘ID’ heading that also includes dimensions might be less intuitive to assistive tech).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#36 2025-12-05 10:35:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

phiw13 wrote #341499:

I batch uploaded some 25 images (various sizes and formats). After the upload complete the admin thumbnails did not display. After viewing the edit panel for one image caused all to appear.

This needs possible attention. I uploaded a handful and the thumbs all automatically appeared, but there may be situations where this doesn’t happen that we need to ferret out.

It does depend (I think) on your last action. So if the last image (thumbnail?) you edited was set to ‘None’ or ‘Custom’ then all future thumbs will adopt that convention. Not tested it thoroughly, but that’s the general idea.

This ‘sticky sizes’ feature has been around since day 1, and I didn’t want to rock the boat too wildly, but I guess a dropdown on the image upload widget for thumb type (defaulting to last action) might be useful.

The downside is that you wouldn’t be able to set the size of a custom thumb – it would be preset to the dimensions of the last thumb you edited. And if you haven’t edited any (e.g. on a fresh install) then selecting Custom at upload time would do nothing because there’d be no per-user pref created at that point to indicate the sizes you wanted. Not pretty, and counter-intuitive.

There’s probably a better way to handle this default sizing for custom thumbs, but I just kinda left it as it was for now, warts and all.

Last edited by Bloke (2025-12-05 10:36:23)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#37 2025-12-05 11:01:49

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,671
Website

Re: Automatic thumbnails for Textpattern

jakob wrote #341522:

Here too 👍 👍. Thanks.

My instinct is to shift it up alongside the ID to save space, but that’s easily done in a custom theme (css) with float:left and margin-inline-end on the id block in css.

Bloke wrote #341524:

Mine too. Amendments / PRs welcome if it improves things (though an ‘ID’ heading that also includes dimensions might be less intuitive to assistive tech).

I was thinking more like this: dev.l-c-n.com/txp-4.9/secondary/content-image_edit.html although the horizontal spacing need some attention.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#38 2025-12-05 11:06:18

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,671
Website

Re: Automatic thumbnails for Textpattern

Bloke wrote #341525:

This needs possible attention. I uploaded a handful and the thumbs all automatically appeared, but there may be situations where this doesn’t happen that we need to ferret out.

I am not sure what the last action was, possibly viewing an image that had a custom thumb type. And not all images of my batch uploaded (too big, that install was set to default max-size ) and a warning was triggered.

I‘ll test more tomorrow while taking note of my exact steps.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#39 2025-12-05 11:28:32

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,238
Website GitHub

Re: Automatic thumbnails for Textpattern

I think the markup is okay and correct. Maybe each does what they prefer in their own admin theme (or custom.css file).

  • Philippe’s keeps each in a row of its own but places the value to the right of the label. Looks okay. With grid you could make the indent more consistent, but then labels in different languages vary in length.
  • My earlier quick-fire experiment put the stacked label + field of each next to each other.
  • For myself, I’d probably put them all in one row and hide the “Dimensions” label using .txp-accessibility and place a middot between them. More like the ID information on the write tab.

EDIT: But the dropdown above the thumb could do with some margin-bottom like .image-replace has for the main image, e.g.:

 .txp-thumb-type {
    margin-block-end: 1em;
}

TXP Builders – finely-crafted code, design and txp

Offline

#40 2025-12-05 12:16:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

Is there any existing semantically applicable class I can add to the thumb type wrapper to apply that bottom margin? I’m conscious that I don’t have write access to Phil’s admin side repo, and even if I did I’d need to install SASS/SCSS and figure out how to rebuild the minified source properly.

As for the id+dimensions, I’m easy, though it does take up possibly unnecessary vertical space as it stands. I like the inline version best, but the two blocks stacked side by side also works for me.

Are either / both achievable with core classes and markup patterns? If not, would it be helpful to add one?

Last edited by Bloke (2025-12-05 13:35:09)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#41 2025-12-05 12:57:52

etc
Developer
Registered: 2010-11-11
Posts: 5,690
Website GitHub

Re: Automatic thumbnails for Textpattern

First report:

Function imagedestroy() is deprecated since 8.5, as it has no effect since PHP 8.0

This prevents thumbnails from being displayed on the first load after their creation (PHP 8.5+ only).

Offline

#42 2025-12-05 13:07:07

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,671
Website

Re: Automatic thumbnails for Textpattern

For the thumb type wrapper, use a <p>. automatically you get a margin-block-end as needed.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#43 2025-12-05 13:14:30

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

etc wrote #341531:

Function imagedestroy() is deprecated since 8.5, as it has no effect since PHP 8.0...

Bah. Better now?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#44 2025-12-05 13:21:45

etc
Developer
Registered: 2010-11-11
Posts: 5,690
Website GitHub

Re: Automatic thumbnails for Textpattern

Different.

Non-canonical cast (integer) is deprecated, use the (int) cast instead on line 670

Offline

#45 2025-12-05 13:22:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,513
Website GitHub

Re: Automatic thumbnails for Textpattern

phiw13 wrote #341532:

For the thumb type wrapper, use a <p>. automatically you get a margin-block-end as needed.

If only everything was so easy

Thank you.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB