Different thumbnail sizes for category/album pic and thumbs-view? Different thumbnail sizes for category/album pic and thumbs-view?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Different thumbnail sizes for category/album pic and thumbs-view?

Started by lamama, December 26, 2007, 09:58:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lamama

I want small thumbs for the "normal" thumbail-view, but bigger thumbs for the category/album pictures - and I'm looking for advice how to code it the best way :)

Is there something like a theme-related setting (hardcoded thumb size)?
To set the thumb-size for the thumbs-view inside the theme and set the bigger value for category/album-pics inside the config-panel?

(I fear this has been asked before, but I've found nothing...)

I don't expect a ready-to-run solution, just a hint where to start...    ;)

Joachim Müller

Coppermine just creates one set of thumbnails as you probably are aware of. You specify the size in "Config" -> "Files and thumbnails settings" -> "Max dimension of a thumbnail"; that's the physical size of the thumbnails. There is another place in coppermine's config ("Album list view" -> "Size of thumbnails in pixels") where you can specify thumbnail sizes - that's the dimension of thumbnails that will be displayed as album thumbnail on the category and album list view. The physical size of the image used for those thumbnails is the same that you specify in "Files and thumbnails settings" -> "Max dimension of a thumbnail", however the HTML code (width and height attributes of the <img>-tag) that embedds the thumbnail is set to the dimensions you specify in "Album list view" -> "Size of thumbnails in pixels". This is great as long as the thumbnail size for the album thumbs is less or equal to the physical size. If the album thumb dimensions are considerably larger than the physical dimensions (and that's what you're apparently after), then the album thumbnails will look distorted, as the browser expands the thumbnail to a width that doesn't fit.
Bottom line: the feature you're looking for already exists as long as you don't specify album thumbnail dimensions that considerably differ from the actual thumbnail sizes. If you need much larger dimensions for the album thumbnails, you'll have to modify coppermine's core code to a great extent.

lamama

Quoteyou'll have to modify coppermine's core code to a great extent.
I'm not afraid of that   ;D

Indeed, the problem is: albumlist-thumbs are larger than the physical thumbail sized that coppermine generates for the usual thumbnail-view, so they look distorted.

Few weeks ago I saw a theme with internal settings for colums and similar config-values (like this)...

$CONFIG['thumbcols'] = 4; //overrides the number of columns for thumbnails.
$CONFIG['main_table_width'] = '100%'; //overrides the Width of the main table (pixels or %).
$CONFIG['picture_table_width'] = '100%'; //overrides the Width of the table for file display (pixels or %).
$CONFIG['album_list_cols'] = 2; // sets "Number of columns for the album list = 3"


That's why I thought something simliar maybe already exists for the output-thumbsize.
In that case the code modification would hopefully be limited to that theme-related setting - plus increasing the size for the physical thumbsize.

So, if there's no such config-switch, I'll try to convice my cpg with another dirty hack  ::)


lamama

Ok, I found something hat meets my needs  :)


file: function.inc.php

look for: function display_thumbnails

find:
                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);

replace with:
                        $image_size = compute_img_size($row['pwidth'], $row['pheight'], '70');

Instead of '70' use the value you find suitable for the height/width of your output-thumbnail-size.

I've increased the size of the physical thumbnails ("Config" -> "Files and thumbnails settings" -> "Max dimension of a thumbnail") to 90 (height).
Album list view" -> "Size of thumbnails in pixels" is at 80 for the moment.

Works  ;D

lamama

The easiest way (and possibly best, because no core code modification needed):

file: themes/your-fav-theme/theme.php

find: a nice place at the top of the file, maybe right after the DEFINEs, like....

define('THEME_HAS_NO_SUB_MENU_BUTTONS', 1);

insert after:
$CONFIG['thumb_width'] = 70; // overrides output-size for thumbnails in thumbnail-view.

EDIT:
I was overhasty... setting it this way has the same result as setting it via CPG Config Panel. 
Take the previous post, this doesn't make much sense... :-X

Joachim Müller

Just as a clarification: the array $CONFIG contains all settings you can make in coppermine's config. If a theme author decides to override them in his theme, he just forces the end users of the theme to use particular settings that make the theme look good. The theme author could just as well post instructions along with his theme how to set particular config options - this would have the same result. This being said: with setting some specific value of the $CONFIG array in theme.php you can only override the config, but you can't accomplish new features, so there is little use in looking into them in detail.

lamama

Yeah, that what I found out the "hard" way  ;)

You can mark this thread as solved...