[imageselectorplus] thumbnail-size

Creating and modifying plugins.
Post Reply
bernd_d
Regular
Posts: 466
Joined: Thu Jun 03, 2010 9:28 am
Contact:

[imageselectorplus] thumbnail-size

Post by bernd_d » Fri Jul 25, 2014 5:45 pm

Maybe we already talked about this problem, but i didn't find the old discussion.


The landscape-thumbnails in this entry is included this way:

Code: Select all

<img width="200" height="133" src="/uploads/2014/07/23_Elefantenanlage/DSC_9227.serendipityThumb.jpg">
As you can see here, the image is larger (300x200).


Another example with portrait-format:

Code: Select all

<img width="133" height="200" src="/uploads/2014/07/23_Elefantenanlage/DSC_9220.serendipityThumb.jpg">
This thumbnail is included within gallery with the right size in width and height.

My settings for image-resizing:
Core: Size 200px/Height
Plugin: Maximum width of thumbnail 0 / Maximum height of thumbnail 0


Easiest solution would be to remove width/size from tpl-file, but this will only work until next update.

Is this a bug that can be fixed or otherwise could be a plugin-setting included not to set width/height for thumbnails? Or maybe we could get an option to use something like "user-gallery.tpl"?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [imageselectorplus] thumbnail-size

Post by Timbalu » Fri Jul 25, 2014 7:29 pm

You mean this? http://board.s9y.org/viewtopic.php?f=3& ... p=10432676

The Plugin imageselectorplus uses plugin_mediainsert.tpl to convert <mediainsert>... </mediainsert> galleries into real markup.
As far as I know, you can copy this file to your template/theme to make your own modifications.

Did you try that?

You have to be aware that entryproperties cache is or can be involved. To see changes then, you have to save your entry again.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

bernd_d
Regular
Posts: 466
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: [imageselectorplus] thumbnail-size

Post by bernd_d » Sat Jul 26, 2014 6:40 pm

Yes, that's it.
Timbalu wrote:The Plugin imageselectorplus uses plugin_mediainsert.tpl to convert <mediainsert>... </mediainsert> galleries into real markup.
As far as I know, you can copy this file to your template/theme to make your own modifications.

Did you try that?
Not until now. But i'll do.

But finally it doesn't solve the problem as it is. The gallery uses wrong thumbnail-sizes for generating output.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [imageselectorplus] thumbnail-size

Post by Timbalu » Sat Jul 26, 2014 7:21 pm

It does - 301px × 200px (scaled to 200px × 133px), and I indeed would not say this is actually wrong, since this is IMHO done to build a clean gallery grid.

But I thought you said, you wanted to prevent this by removing the width="{$medium.thumbwidth}" height="{$medium.thumbheight}" from the tpl file, didn't you? (And the div ... style="width: {$medium.thumbwidth}px" btw too!) Then it would use the correct thumbnail size to display.

Or even simpler use something like this:

Code: Select all

.serendipity_mediainsert_gallery .serendipity_imageComment_left,
.serendipity_mediainsert_gallery img { width: auto !important; }
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

bernd_d
Regular
Posts: 466
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: [imageselectorplus] thumbnail-size

Post by bernd_d » Mon Jul 28, 2014 5:48 pm

Timbalu wrote:But I thought you said, you wanted to prevent this by removing the width="{$medium.thumbwidth}" height="{$medium.thumbheight}" from the tpl file, didn't you?
Yes i did and it works, with tpl-file within template-directory too.

But this solution is not as it should work, i think.

If width/size within tpl is hardcoded, what does "Maximum width of thumbnail (discards height)" (height too) within plugin-settings? There is 0 in both cases. Why does the plugin use this 200px width? If i understand the text above as i think it should be, there should be no width/height tag within output if i set value to 0 so thumbs will be included with the size they are. Maybe we could/should rewrite tpl-file to work this way?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [imageselectorplus] thumbnail-size

Post by Timbalu » Mon Jul 28, 2014 7:31 pm

Did you also try the css instead?
bernd_d wrote:If width/size within tpl is hardcoded, what does "Maximum width of thumbnail (discards height)" (height too) within plugin-settings? There is 0 in both cases. [...] If i understand the text above as i think it should be, there should be no width/height tag within output if i set value to 0 so thumbs will be included with the size they are.
I definitely need some more insight here, but on first quick look it does this:
If these two options are set to default 0, image width and height are set to 0 in https://github.com/s9y/additional_plugi ... s.php#L169
and in this case get calculated by serendipity_calculate_aspect_size() in https://github.com/s9y/Serendipity/blob ... .php#L1355 to a calculated new size for an image, considering aspect ratio and constraint, which is orientated on the smallest or largest constraints (?~only, or even with width and height constraints too~?) (*) size to make the grid. This is what is pushed to the mediainsert.tpl image size attributes. So it looks like its doing the opposite than what you think it should do...

Well, as I said, I need some more insight here, I have never played around changing these options, so just put this into "". ;-)
bernd_d wrote:Why does the plugin use this 200px width?
hmm, maybe its because you tweaked it to (~?~):
bernd_d wrote:My settings for image-resizing:
Core: Size 200px/Height
(*) Configuration - Image Convert (select box) "Bestimmung der maximalen Vorschaubildgröße": defaults to original behavior, 'largest'.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

bernd_d
Regular
Posts: 466
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: [imageselectorplus] thumbnail-size

Post by bernd_d » Mon Jul 28, 2014 9:01 pm

Timbalu wrote:Did you also try the css instead?
No, one solution is enough for me... ;)

I'll leave it the way it is now. Maybe i'm the only one who has this "problem" (maybe it only looks like a problem for me).


btw: I think, images in a gallery should all have the same height. It looks/floats a little bit ugly, if portrait-formats are higher than landscapes.

Maybe i should also think about squaring all thumbs with imagemagick...

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [imageselectorplus] thumbnail-size

Post by Timbalu » Tue Jul 29, 2014 12:34 pm

Maybe you should wait for an answer by Garvin, since these Serendipity and Plugins image functions are complicated stuff and not only there for simple 'level 1' needs. Its far more extended and intermeshed with options, plugin needs etc.

About squaring all thumbs and the height problem, I remember we had a german thread, in combination with usergallery, with a suggested Smarty solution at the end: http://board.s9y.org/viewtopic.php?f=10&t=18967
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Post Reply