Replace album view with slideshow Replace album view with slideshow
 

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]

Main Menu

Replace album view with slideshow

Started by roban, November 18, 2009, 01:17:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

roban

I have searched and read through 11 pages of posts hoping to find an answer that will work but alas, I haven't found it.

I am using version 1.4.19.  When clicking on an album, instead of thumbnails, I'd like to go directly to the slideshow for that album.  I am using project vii theme and the site is at http://lhsclassof59.org/reunion.

TIA for any direction.

Joachim Müller

Quote from: roban on November 18, 2009, 01:17:39 PM
I am using version 1.4.19. 
Then you should upgrade to the most recent stable release (currently cpg1.4.25) first. This will not answer your question, but will fix known security issues.

roban


Joachim Müller

Quote from: roban on November 18, 2009, 01:17:39 PMWhen clicking on an album, instead of thumbnails, I'd like to go directly to the slideshow for that album. 
Personally, I'd hate it if I were on a site where this happened, but that's a matter of taste after all. To accomplish what you're up to, you will need to edit your custom theme, i.e. themes/yourtheme/theme.php
You'll notice that there are a lot of different links in coppermine that will send users to a particular thumbnail page. Subsequently, you will have to perform a lot of edits to accomplish what you're up to. As a first step, you should do so for the album list thumbnails and observe visitor's comments: if they agree that the change is good, look for more places to edit.

Now this is how you do: edit themes/yourtheme/theme.php with a plain text editor, findfunction theme_display_album_listand edit as suggested below. If you don't have a custom function definition for theme_display_album_list in your theme (i.e. if you can't find that section in your theme), copyfunction theme_display_album_list(&$alb_list, $nbAlb, $cat, $page, $total_pages)
{

    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list, $lang_album_list;

    $theme_alb_list_tab_tmpl = $template_tab_display;

    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
    $theme_alb_list_tab_tmpl['inactive_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
    $theme_alb_list_tab_tmpl['inactive_next_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
    $theme_alb_list_tab_tmpl['inactive_prev_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));

    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);

    $album_cell = template_extract_block($template_album_list, 'album_cell');
    $empty_cell = template_extract_block($template_album_list, 'empty_cell');
    $tabs_row = template_extract_block($template_album_list, 'tabs');
    $stat_row = template_extract_block($template_album_list, 'stat_row');
    $spacer = template_extract_block($template_album_list, 'spacer');
    $header = template_extract_block($template_album_list, 'header');
    $footer = template_extract_block($template_album_list, 'footer');
    $rows_separator = template_extract_block($template_album_list, 'row_separator');

    $count = 0;

    $columns = $CONFIG['album_list_cols'];
    $column_width = ceil(100 / $columns);
    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;

    starttable('100%');

    if ($STATS_IN_ALB_LIST) {
        $params = array('{STATISTICS}' => $statistics,
            '{COLUMNS}' => $columns,
            );
        echo template_eval($stat_row, $params);
    }

    echo $header;

    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }

    $params = array('{COL_WIDTH}' => $column_width,
          '{SPACER}' => $thumb_cell_width
          );
    $empty_cell = template_eval($empty_cell, $params);

    while ($count++ % $columns != 0) {
        echo $empty_cell;
    }

    echo $footer;
    // Tab display
    $params = array('{COLUMNS}' => $columns,
        '{TABS}' => $tabs,
        );
    echo template_eval($tabs_row, $params);

    endtable();

    echo $spacer;
}
from themes/sample/theme.php into a new line before?>of the file themes/yourtheme/theme.php

The code that you actually need to change is the link target, so you need to find                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",and change that to                '{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&amp;pos=0&amp;slideshow=5000",to send the visitor directly to the slideshow for that album, starting with the first file inside that album.

To give you an idea what you need to do to accomplish this feature for all possible links that currently point to the thumbail page (i.e. to get rid of the thumbnail page entirely and only leave the slideshow, perform a search for thumbnails.php in the file themes/sample/theme.php. You'll notice that there's a lot of references to that file, and you'd have to change most of them (you should not change the code that composes the film strip and the code that is used for the output of thumbnails.php). Not a bright idea if you ask me, but anyway: it's your site.

As an alternative, let me suggest using the enlargeIt plugin plus the slider plugin: both come from Timo and should do nearly the same with a much neater interface.

daleybob

Thank you for the post; this does almost what I want.  I want to simply open the album (large image + filmstrip) instead of the slideshow.  In the ALB_LINK_TGT what would I use as parameters for this?

daleybob

Ok, so I found the post I was looking for and am using:
'{ALB_LINK_TGT}' => "displayimage.php?album={$album['aid']}&pos=0",
However, using "pos=0" results in an error about invalid file.  If I use "pos=1" then it opens, but at image 2.  I can live with that but wonder about a fix.