Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: Making custom theme 100% operational  (Read 3367 times)

0 Members and 1 Guest are viewing this topic.

Walker

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
[Solved]: Making custom theme 100% operational
« on: April 17, 2008, 01:25:10 pm »

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:
Code: [Select]
    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:
Code: [Select]
    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:
Code: [Select]
    $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.
« Last Edit: April 17, 2008, 03:34:15 pm by Stramm »
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Making custom theme 100% operational
« Reply #1 on: April 17, 2008, 02:42:49 pm »

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

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Making custom theme 100% operational
« Reply #2 on: April 17, 2008, 03:16:56 pm »

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
Code: [Select]
    $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.
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.