[Solved]: Making custom theme 100% operational [Solved]: Making custom theme 100% operational
 

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

[Solved]: Making custom theme 100% operational

Started by Walker, April 17, 2008, 01:25:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Walker

After configuring CPG with modpack to use square thumbs (120x120) I encountered 2 major problems:
     1) The intermediate page was now displaying the full size image instead of the resized (normal_) image
     2) Images that were less than or equal to the intermediate size (640 in my case) were being resized via html to fit in a 120x120 box (example screen shots attached)

I searched the boards and found others with these issues, but the only fix offered was to remove function theme_html_picture() from theme.php
While that worked fine, I require a modified function theme_html_picture() to use a FLV player.  Well I actually managed to figure this one out on my own before asking for help  ;D
So if you have a custom theme that includes function theme_html_picture(), I found the following fixes worked for me:

Mod for problem #1)
     In theme.php find:     if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }else{
     $condition = false;
    }

     And replace with:     if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='ex' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }else{
     $condition = false;
    }


Mod for problem #2)
     In theme.php find and delete:     $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);


I don't know if this was the best way to go about it, but it worked for me.  I hope this helps somebody.

Stramm

If you really need a modded function theme_html_picture(), then you copy it from include/themes.inc.php to the theme.php you're actually using and modify it to your needs (in a standard coppermine you'd copy the functions from themes/sample/theme.php).
There are more changes in function theme_html_picture()... so you may experience glitches

Deleting the line you mentioned... not sure what to say here cause I do not know in what context it was. If it's also in function theme_html_picture(), then it's better to modify it or to use a copy of the theme.inc.php version as base to do your own modifications

Walker

Doh!  And here I thought that I had accomplished something  ::)
I did not realize that I should be using include/themes.inc.php as base when using the modpack instead of themes/sample/theme.php, but I am now coming to an understanding of what the include/ files are for.
Your modified themes.inc.php already includes the first change that I mentioned (at least I got that right).  As for deleting the line that I mentioned, I knew that was probably not the best way to do it (but it worked), I just didn't know how to modify it correctly.  You have it as     $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width'], 'normal'); in your modified themes.inc.php.

So I copied function theme_html_picture() from themes.inc.php, made the changes to include the FLV player, and all works well now.
Thank you, I'm learning more every day.