Page 1 of 2

Media Library Images - force width of thumbnail?

Posted: Sun Feb 10, 2008 8:07 pm
by Don Chambers
The auto-generated thumbnail image has a field for "Thumbnail dimensions" with an English description of "Static maximum width of auto-generated thumbnails". The default value is 110px. The reality of this field seems to impose a maximum width (image wider than tall) OR HEIGHT (image taller than wide).

I want the ability to force a width based on this setting... perhaps it could be a radio button? In other words, I don't just want a width to be a maximum, I want a thumbnail to always be that specified width.... so the width becomes the deciding factor on scaling, which means the height could exceed that value. Perhaps the opposite of that is also a good idea, so perhaps a field for width, a field for height, and an option for which takes priority and possibly a second option (if necessary) to force the specified priority size.

This seem reasonable?

On a related note... searching the forum showed a number of requests for a 3rd image size... something in between a thumbnail, and full size. Add my voice to that suggestion! :)

Re: Media Library Images - force width of thumbnail?

Posted: Sun Feb 10, 2008 8:53 pm
by garvinhicking
Hi!

Have you tried the imageselectorplus plugin? It can created square thumbnails with fixed widths. David Cummings requested that a long time ago. :)

Regards,
Garvin

Posted: Sun Feb 10, 2008 11:18 pm
by Don Chambers
Nope! Didn't even know it existed!!! :oops: I'll give it a try and see if it does what I want.

On a sidenote, does anything turn off the creation of thumbnails?

Posted: Mon Feb 11, 2008 4:07 pm
by garvinhicking
Hi!

Uninstalling gdlib or imagemagick will turn off thumbnails *g*

Regards,
Garvin

Posted: Mon Feb 11, 2008 5:37 pm
by Don Chambers
garvinhicking wrote:Hi!

Uninstalling gdlib or imagemagick will turn off thumbnails *g*

Regards,
Garvin
I was thinking something like if that width value was 0 it would turn off the creation of thumbnails...

Anyway, I looked at the imageselectorplus plugin. It is a markup plugin that limits the displayed size of an image.... what I am after is the ability to create a specific size thumbnail when the large image is first added to the media library. Something that would be similar in concept is forcing either the height or width to become the target dimension of the generated thumbnail.

Right now, if I upload a 400 x 300 image, and set the Thumbnail dimensions to 100, the thumbnail does become 100px wide (and 75px high).. which is great. However, if I upload a 300 x 400 image, the resulting thumbnail is 100px high, and only 75px wide. What I was looking for was the ability to force the thumbnail to be the specified width all the time.... and perhaps others might want to make height take precedence.

Posted: Mon Feb 11, 2008 7:08 pm
by garvinhicking
Hi!

Hehe, I knew this would come. Good one, I just committed the 0=off routine :)

imageselectorplus also converts thumbnail images, it is only for other regards a markup plugins. It does many things, inside the configuration you should be able to define a thumb size?!

regards,
garvin

Posted: Fri Mar 14, 2008 11:35 pm
by Don Chambers
Garvin - it has taken me awhile to finally check this out, but I did.

The imageselectorplus plugin has far too much overhead for what I need to accomplish - which is just imposing a thumbnail size. First of all, it is yet another plugin to install. Next, options for unzipping, galleries, and quickblogs... nice to have features - if you need them.... but I am presented with a situation where all I need is the ability to force the thumbnail size to either a specific width (regardless of height), or a specific height (regardless of width).....

Now, serendipity's configuration is already misleading. It says "Thumbnail dimensions: Static maximum width of auto-generated thumbnails". We know that is not true. It is the maximum of whichever is greater - width or height. So at minimum, that needs clarification.

Next - even with the imageselectorplus plugin installed, it does not impose it's dimensions unless the image was added via the media manager. If files are uploaded directly to the /uploads/ folder, serendipity's configuration value for thumbnails takes over. Same goes for "rebuild thumbs".

So here is my request... please add the same functionality of width (ignore height) or height (ignore width) that the plugin has. This could be in lieu of how it works now, or possibly in addition to it as I can see someone wanting it to work the way it currently does.

I still would not mind an option to create a 3rd "medium" auto-generated image, but that is not a huge priority for me. Nailing down this thumbnail size is much more important, and I think it cleans up the current misleading explanation of how it works, plus allows the preferred thumbnail dimensions to work when images are directly uploaded, or if "rebuild thumbs" is used.

Posted: Mon Mar 17, 2008 10:39 am
by garvinhicking
Hi!
The imageselectorplus plugin has far too much overhead
But the plugin is generally built for that; we could port that piece of code to the core, but I actually don't see the requirement for that and it will create redundant code. I hate that. Maybe some developer can find a nice way to implement it into the core so that it integrates nicely without too much redundancy?

What I'd actually like to see even better would be that the plugin would resize thumbnails also for "rebuild thumbs"...
Now, serendipity's configuration is already misleading. It says "Thumbnail dimensions: Static maximum width of auto-generated thumbnails". We know that is not true. It is the maximum of whichever is greater - width or height. So at minimum, that needs clarification.
Yeah, the function that the height was also used was added later in the code, and nobody updated the description text.

Feel free to change the wording of that in serendipity_lang_en.inc.php! :)

IMHO using a fixed width+height option is not good for the average blogger, that simply wants to have properly proportioned thumbnails that fit into a maximum size? I find that already quite intuitive, and adding second width/height inputs IMHO seems to obfuscate the process for the average blogger (that has used s9y in the past versions, and from what I gather, they are quite happy with default thumbnails). Just to clarify my point that the functionality is somewhat more a "plugin" and not "core".

Regards,
Garvin

Posted: Mon Mar 17, 2008 5:36 pm
by Don Chambers
I just can't give up on this yet Garvin!!! :lol:

OK - so the array is out.

What I think is important is for thumbnails to be consistent across a specific dimension. If I have a layout that relies heavily on width presentation, I would need to force ALL thumbnails to an expected width regardless of height. Same applies to a layout that might be heavily dependent on multiple containers having a consistent height.

What I really do not like about the plugin is that a) it is not sync'd with the media library when images are directly uploaded, b) does not override the core thumbnail dimensions when rebuilding thumbs, and c) requires the overhead of yet another plugin d) presents users with a lot of additional options (ie, unzipping, quickblog entry, galleries, etc).

The fact that this functionality might be redundant with the plugin IF added to the core is, IMHO, an indication that it should be in the CORE and not the plugin.... but perhaps you do not like to remove a plugin feature once it is out there.

But how many people are using that plugin to create thumbnails vs. users creating thumbnails from the core???!!! I think that plugin was created for a very specific need and I sincerely believe this would be a valuable addition to thumbnails in the core!!!

Perhaps this is a simple approach - a single field, just like now, for a thumbnail dimension.... follow that with a 3-choice radio button that imposes the dimension on: width, height, greater of w&h - this last one being the current method, which could continue to be the default so it is BC.

Posted: Mon Mar 17, 2008 8:41 pm
by judebert
I propose "Thumbnail max size" for the replacement descriptive text.

I've always wondered why we don't have the constraining functionality, myself. I bumped into it when I started looking at template design, and I was surprised that designers hadn't been requesting it.

I think a "Constrain which thumbnail dimension?" option with "Largest", "Width", and "Height" buttons, with "Largest" selected by default, fills everyone's requirements. Template authors requiring one or the other could mention it in their config.inc.php, so users know what's required. (Heck, they could even set it.)

I'd probably make the changes around line 641 of functions_images.inc.php, right after we got the existing image's size. By checking whether $size is an array, we can even avoid messing up functions that pass in a specific size.

Posted: Tue Mar 18, 2008 10:01 am
by garvinhicking
Hi Judebert!

Sounds great! :)

Regards,
Garvin

Posted: Wed Mar 26, 2008 6:46 pm
by judebert
So I've completed the code for this modification. I've tested it on a sandbox server, with large and small images. I've passed it to Don, and he's approved it.

We have only one issue: the way s9y handles rebuilding its thumbs.

Right now, the 'sync' step doesn't seem to pay attention to anything but the existence of a thumbnail. This is probably the intended behavior, since we wouldn't want to overwrite somebody's custom sized (or custom image) thumbnail.

However, if you switch to a theme that requires a constrained height or width, you'll need to rebuild all your thumbs. Right now, that means deleting them, one at a time, with an FTP program or host-provided file manager.

The obvious solution is to provide an extra option, either in the admin menu or the rebuild popup, that FORCES thumbnails to be rebuilt to the current settings.

We could also cause thumbnails to be deleted when the thumbnail size is changed in configuration, and then a rebuild would also work as expected. But I think that's probably a little less intuitive.

Comments?

Posted: Wed Mar 26, 2008 7:01 pm
by Don Chambers
judebert wrote:I've passed it to Don, and he's approved it.
I've "approved it"???!! :lol:

More like, I tested it, and it worked as expected and desired!!! :wink: Another great job Judebert! Many thanks. Hopefully Garvin or others will comment on the thumb rebuild option. I can see having the option to rebuild all, or some subset, very valuable.

Posted: Thu Mar 27, 2008 10:24 am
by garvinhicking
Hi!

I think the best way would be to make the "REbuild Thumbs" menu item give the user a checkbox where he can choose "Yes, purge existing thumbnails" or "No, keep existing thumbnails".

Regards,
Garvin

Posted: Fri Mar 28, 2008 4:11 pm
by judebert
Is there a way to include a checkbox on an admin menu item?