Advanced search  

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

Pages: [1]   Go Down

Author Topic: How using smaller thumbs for the filmstrip?  (Read 3485 times)

0 Members and 1 Guest are viewing this topic.

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
How using smaller thumbs for the filmstrip?
« on: December 01, 2005, 12:39:44 am »

As I am in progess of adapting the themes to my needs I discovered another problem which I can't solve by myself. I included the filmstrip into my theme which is based on the classic theme. All thumbs of my site have the same size. I would like to use smaller thumbs for the filmstrip. Is there a way to set the thumbs used for the filmstrip to a smaller size (e.g. max. height/width 65 px)? I coulnd't find a solutuion on the forum search. But maybe I missed something.
« Last Edit: December 05, 2005, 07:22:18 am by GauGau »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: How using smaller thumbs for the filmstrip?
« Reply #1 on: December 03, 2005, 09:55:51 pm »

Put this in your theme.php

Code: [Select]
function theme_display_film_strip(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $pos, $sort_options, $mode = 'thumb')
{
    global $CONFIG, $THEME_DIR;
    global $template_film_strip, $lang_film_strip;

    static $template = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $spacer = '';

    if ((!$template)) {
        $template = $template_film_strip;
        $thumb_cell = template_extract_block($template, 'thumb_cell');
        $empty_cell = template_extract_block($template, 'empty_cell');
    }

    $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat;

    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['max_film_strip_items']) . '%';

    $i = 0;
    $thumb_strip = '';
    foreach($thumb_list as $thumb) {
        //modify $new_size for max dimension of thumbnails in filmstrip
        $new_size = 65;
        preg_match('/(?<=width=")[0-9]*/',$thumb['image'],$matches,PREG_OFFSET_CAPTURE);
        $srcWidth=$matches[0][0];
        preg_match('/(?<=height=")[0-9]*/',$thumb['image'],$matches,PREG_OFFSET_CAPTURE);
        $srcHeight=$matches[0][0];
        $ratio = max($srcWidth, $srcHeight) / $new_size;
        $ratio = max($ratio, 1.0);
        $destWidth = (int)($srcWidth / $ratio);
        $destHeight = (int)($srcHeight / $ratio);
        $thumb['image']=preg_replace('/width="[^"]*"/','width="'.$destWidth.'"',$thumb['image']);
        $thumb['image']=preg_replace('/height="[^"]*"/','height="'.$destHeight.'"',$thumb['image']);
        $i++;
        if ($mode == 'thumb') {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => '',
                '{ADMIN_MENU}' => ''
                );
        }
        $thumb_strip .= template_eval($thumb_cell, $params);
    }

    if (defined('THEME_HAS_FILM_STRIP_GRAPHICS')) {
        $tile1 = $THEME_DIR . 'images/tile1.gif';
        $tile2 = $THEME_DIR . 'images/tile2.gif';
    } elseif (defined('THEME_HAS_FILM_STRIP_GRAPHIC')) {
        $tile1=$tile2=$THEME_DIR . 'images/tile.gif';
    } else {
        $tile1=$tile2= 'images/tile.gif';
    }

    $params = array('{THUMB_STRIP}' => $thumb_strip,
        '{COLS}' => $i,
        '{TILE1}' => $tile1,
        '{TILE2}' => $tile2,
        );

    ob_start();
    starttable($CONFIG['picture_table_width']);
    echo template_eval($template, $params);
    endtable();
    $film_strip = ob_get_contents();
    ob_end_clean();

    return $film_strip;
}
Logged

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: How using smaller thumbs for the filmstrip?
« Reply #2 on: December 04, 2005, 12:31:46 am »

Thanks donnoman. That works very well for me!
Logged

wieland

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 7
  • -- Listen to the Wind
    • Kublun.com
Re: How using smaller thumbs for the filmstrip?
« Reply #3 on: March 20, 2006, 08:28:08 pm »

thanks!! worked for me too  ;) ;) ;)
Logged

jonplqs

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: How using smaller thumbs for the filmstrip?
« Reply #4 on: July 26, 2006, 01:44:04 am »

Thanks for the code its works.... I have a question. Can i put two rows in the film strip ?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How using smaller thumbs for the filmstrip?
« Reply #5 on: July 26, 2006, 06:19:13 am »

Don't try to hijack a FAQ thread.
Logged

jonplqs

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: How using smaller thumbs for the filmstrip?
« Reply #6 on: July 26, 2006, 06:37:14 pm »

 ??? ???
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How using smaller thumbs for the filmstrip?
« Reply #7 on: July 26, 2006, 07:02:49 pm »

This thread explains how to have smaller thumbs in filmstrip. Only questions that directly relate are allowed. Putting two rows into the film strip is an entirely different animal. Therefor, your question doesn't belong here (just because the thread deals with "filmstrip"). It should go into a new thread.

Imagine a driving instructor giving a tutorial on truck driving. All his pupils are wannabe-truck drivers who want to hear about truck driving. They came from far away to learn how to drive a truck. Then suddenly someone turns up and says: "you're a driving instructor, teach me how to drive a bike". Do you think the driving instructor would be willing to do so? Do you think the audience (remember, they came specifically to learn about truck driving) would like the driving instructor to drift away from the original thread and explain something completely else during the "truck driving lesson"? Of course you wouldn't expect nor want this to happen. The driving instructor would instead say "come later, when the truck driving lessons are over and the others won't be kept waiting. I'll teach you how to drive a bike then."

Did you like my little story? In real life, everybody agrees that it's common sense not to interfere with something completely unrelated, yet in the world of computers (and particularly on forums, mailing lists etc.) people like to think that it's OK not to use common sense and butt in with their unrelated questions.
This is not individual support, where you could jump from one topic to another. We don't do individual support. We believe in this forum as a sort of "knowledge repository" on everything related to coppermine. You need discipline - that's why board rules exist (to remind people of the rules that are needed to keep this forum intact and functional). People who misbehave are told so, yet we expect them to look up what they did wrong after having been told so.

Bottom line: butt out of this thread. Start a new one instead, providing as much detail as possible.

Joachim
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.