Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Today 07:00:30

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,408
Website GitHub Mastodon

Manual thumbs in 4.9: How to preserve the source image's aspect ratio?

Up to version 4.9, Textpattern allowed manual thumbnail generation by specifying only one dimension (either thumb width or thumb height). The generated thumbnail would then be resized by applying the aspect ratio of the source image to the thumbnail, provided that the ‘crop’ setting was disabled.

This could be achieved by leaving either the width or height input empty in the ‘Edit image’ form, and it works in Txp 4.9 in the same way.

In Txp < 4.9, the values entered in ‘width’ or ‘height’, or the absence of values, were persisted for subsequent thumbnail generation, i.e. thumbnails were always created with the correct aspect ratio.

Since version 4.9, the ‘width’ and ‘height’ inputs receive persistent pixel values derived from the currently edited image, even if one of these inputs is empty when thumbnail creation is invoked.

This may or may not serve the user’s intent.

Personally, I’d rather Textpattern persisted an empty value for thumb width or thumb height, so that I could fulfil my layout’s requirements regarding thumb width without ever having to consider the thumb height.

Offline

#2 Today 08:16:59

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

Re: Manual thumbs in 4.9: How to preserve the source image's aspect ratio?

Hmmm, I thought the manual generation would continue as it did. So if you hit Create Thumbnail on any image with dimensions set, it would store those dimensions for all future created manual thumbnails until you changed them.

I can’t remember offhand what happens if you blank out one of the values and create a manual thumb. It should empty out the value and store the thumb_w / thumb_h with nothing so the aspect ratio remains.

Perhaps class.thumb is not doing the generation properly any more.

Would you please outline a STR process I can run through so I can be clear on what you expect Vs what 4.9.1-dev is doing?

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

#3 Today 09:16:32

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

Re: Manual thumbs in 4.9: How to preserve the source image's aspect ratio?

Bloke wrote #342260:

[…] I can’t remember offhand what happens if you blank out one of the values and create a manual thumb. It should empty out the value and store the thumb_w / thumb_h with nothing so the aspect ratio remains.

Textpattern at 4.9.1 dev, PHP 8.5.2. Here is what I see: I ask for a custom thumbnail (say: 300px w), vacate the height field, and uncheck the crop. Thumb is created at desired width, aspect ratio is preserved, and both w and h field are pre-filled with the values from the image. (nice, I can see the dimensions of the thumbnail image !)

I then upload an image – with a different aspect-ratio. A “custom” thumb is generated automatically at the same width as the previous image but the aspect ratio is preserved again. The dimension fields are prefilled with the new values.

Caveat maybe: Under Admin > Preferences > Admin theme, the crop ratio field is left blank.

Minor nitpick, it would be nice if the custom size thumbnail generation was not applied immediately after uploading. That would be a welcome break with past.


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

Offline

#4 Today 09:39:40

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,408
Website GitHub Mastodon

Re: Manual thumbs in 4.9: How to preserve the source image's aspect ratio?

Sorry, I think I was mixing decade-old habits with the new thumbnail UI processes and getting a few steps confused.

While trying to build the STR, I pinpointed what had stumped me: When manually creating a new thumbnail for the same image repeatedly while staying on the ‘Edit image’ tab in Txp < 4.9, it was sufficient to edit one dimension until the correct size was visible.

Now, you have to edit one dimension and re-blank the other.

Issue resolved, PEBKAC.

Offline

Board footer

Powered by FluxBB