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: Add a link to download compressed albums  (Read 7544 times)

0 Members and 1 Guest are viewing this topic.

dannyvcf

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Add a link to download compressed albums
« on: June 16, 2006, 02:37:05 pm »

Hello!
I want to add a link for download entire albums with the photos compressed in a rar file.  I don't need files to be generated automatically, because I upload them by FTP. What I want is that link to download this file could be generated automatically, with a link to the root of the album and the name of the file that be the same one that of the album.  I don't understand much about php, but I have managed to do what I want and that the link be generated.  I have placed in displayimage.php the option to download the complete album, like he can be verified in the photo, in the circle indicated in red. 

(http://img155.imageshack.us/img155/883/captura37qs.th.jpg)

What I have done he has been to change the code of the displayimage.php: 

Code: [Select]
$info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);
    $info[$lang_picinfo['File Size']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . ' ' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . ' ' . $lang_byte_units[0]);
for
Code: [Select]
$info[$lang_picinfo['Filename']] = htmlspecialchars($CURRENT_PIC_DATA['filename']);
$info['Download'] = '<a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $CURRENT_ALBUM_DATA['title'] . '.rar">Dowload all the pictures of this album in a compress file</a>';
    $info[$lang_picinfo['File Size']] = ($CURRENT_PIC_DATA['filesize'] > 10240 ? ($CURRENT_PIC_DATA['filesize'] >> 10) . '&nbsp;' . $lang_byte_units[1] : $CURRENT_PIC_DATA['filesize'] . '&nbsp;' . $lang_byte_units[0]);

This works good, but I also want to place the same code in the main page of the album. I want that it seems like the next image, where the "Download the pictures in a rar file" be the link to the album that I have modified in the code:

(http://img151.imageshack.us/img151/1643/captura27et.th.jpg)

I think that theme.php is the file that I need to modified to do this, but in that file all the links that appear are variables like "{TITLE}" and if I try to add the code of the link how I did with the other, it doesn't works.
I don't know if is necessary to declare this link how a variable, and it is necessary, I don't know what is the way to do it and what´s the file that I need modify.

I expect that you can understood what I need and that someone can help me, because my english is not very good  :-[
« Last Edit: June 17, 2006, 03:39:13 pm by Paver »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Add a link to download compressed albums
« Reply #1 on: June 16, 2006, 11:13:46 pm »

This should do what you want:

In themes/yourtheme/theme.php, modify the function theme_display_thumbnails (or copy it from the sample theme if you don't have it already) as shown, adding in the one-line mod between comments // MOD - begin and // MOD - end:
Code: [Select]
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
// MOD - begin
$param['{ALBUM_NAME}'] .= ' - <a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $album_name . '.rar">Download all the pictures of this album in a compress file</a>';
// MOD - end
        $title = template_eval($template_thumb_view_title_row, $param);

Add that one line (with the comments around it so you know what you have changed from the default function) and modify the HTML and spacing as you like.
Logged

dannyvcf

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Add a link to download compressed albums
« Reply #2 on: June 17, 2006, 12:18:02 pm »

Thanks a lot! :D

I have tested it and works perfectly ;)
Logged

raffychan

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Add a link to download compressed albums
« Reply #3 on: July 25, 2006, 12:12:16 pm »

Hi,
first of all I was told to post here, altough this topic is set as "solved".

I tried this "hack" as well, but the zip file has to be made and uploaded manually, right?
I wanted to add an album zip download feature and I followed what's written on this thread : http://forum.coppermine-gallery.net/index.php?topic=32758.0 (the topic is closed so I'm forced to write here).
Made the zip.php file and everything works fine.

I know very little php, so I was wondering if it is possible to change the php code poster by Parver in order to let it point to the zip.php file instead of the rar file.
E.g.
http://mysite.com/coppermine/albums/albumname/albumname.rar
That's what I'd like to obtain:
http://mysite.com/coppermine/zip.php?aid=albumid
The "albumid" should be dynamic and change according to the album id the users are visiting.

I know very little php, but I suppose this is the code that has to be changed.
Code: [Select]
// MOD - begin
$param['{ALBUM_NAME}'] .= ' - <a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $album_name . '.rar">Download all the pictures of this album in a compress file</a>';
// MOD - end
       

Sorry for the poor English... hope someone will help me, my galleries are becoming very huge and I really need an album download feature...I don't really care about permissions and stuff... the zip.php file works fine but I have to add the download link manually for each album and that's annoying. Having this php code working in theme.php will do.
Thanks!
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Add a link to download compressed albums
« Reply #4 on: July 25, 2006, 01:35:32 pm »

Ok, this should do it.  Add this to the same function mentioned above (in the same place):
Code: [Select]
        // MOD - begin
        $param['{ALBUM_NAME}'] .= ' - <a href="zip.php?aid='. $aid .'">Link to album archive file</a>';
        // MOD - end
Logged

raffychan

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Add a link to download compressed albums
« Reply #5 on: July 27, 2006, 12:48:23 pm »

Thanks a lot, it works!  ;D ;D ;D
Logged

JesseLeeStringer

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Add a link to download compressed albums
« Reply #6 on: August 03, 2006, 01:53:59 pm »

Hi All,

I've recently had a large surge in members that so far exceeds my expectations, I've recently had an enquiry on how to download an album's contents,
having followed the instructions above I cannot find specifically where this following code is supposed to be inserted,

I am using a modified reynolds theme (Left Sidebar, Not Right)

This should do what you want:

In themes/yourtheme/theme.php, modify the function theme_display_thumbnails (or copy it from the sample theme if you don't have it already) as shown, adding in the one-line mod between comments // MOD - begin and // MOD - end:
Code: [Select]
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
// MOD - begin
$param['{ALBUM_NAME}'] .= ' - <a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $album_name . '.rar">Download all the pictures of this album in a compress file</a>';
// MOD - end
        $title = template_eval($template_thumb_view_title_row, $param);

Add that one line (with the comments around it so you know what you have changed from the default function) and modify the HTML and spacing as you like.

My customised reynolds code following :(theme.php)

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source$
  $Revision$
  $Author$
  $Date$
**********************************************/

define('THEME_IS_XHTML10_TRANSITIONAL',1);
define('THEME_HAS_RATING_GRAPHICS'1);
define('THEME_HAS_NO_SYS_MENU_BUTTONS'1);
define('THEME_HAS_NO_SUB_MENU_BUTTONS'1);


// HTML template for sys menu
$template_sys_menu = <<<EOT
                                        <ul>
<!-- BEGIN my_gallery -->
                                                <li><a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}" class="navmenu">{MY_GAL_LNK}</a></li>
<!-- END my_gallery -->
                                                <li><a href="{FAV_TGT}" title="{FAV_LNK}" class="navmenu">{FAV_LNK}</a></li>
<!-- BEGIN allow_memberlist -->
                                                <li><a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}" class="navmenu">{MEMBERLIST_LNK}</a></li>
<!-- END allow_memberlist -->
<!-- BEGIN my_profile -->
                                                <li><a href="{MY_PROF_TGT}" title="{MY_PROF_LNK}" class="navmenu">{MY_PROF_LNK}</a></li>
<!-- END my_profile -->
<!-- BEGIN faq -->
                                                <li><a href="{FAQ_TGT}" title="{FAQ_TITLE}" class="navmenu">{FAQ_LNK}</a></li>
<!-- END faq -->
<!-- BEGIN enter_admin_mode -->
                                                <li><a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}" class="navmenu">{ADM_MODE_LNK}</a></li>
<!-- END enter_admin_mode -->
<!-- BEGIN leave_admin_mode -->
                                                <li><a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}" class="navmenu">{USR_MODE_LNK}</a></li>
<!-- END leave_admin_mode -->
<!-- BEGIN upload_pic -->
                                                <li><a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}" class="navmenu">{UPL_PIC_LNK}</a></li>
<!-- END upload_pic -->
<!-- BEGIN register -->
                                                <li><a href="{REGISTER_TGT}" title="{REGISTER_TITLE}" class="navmenu">{REGISTER_LNK}</a></li>
<!-- END register -->
<!-- BEGIN login -->
                                                <li><a href="{LOGIN_TGT}" title="{LOGIN_LNK}" class="navmenu">{LOGIN_LNK}</a></li>
<!-- END login -->
<!-- BEGIN logout -->
                                                <li><a href="{LOGOUT_TGT}" title="{LOGOUT_LNK}" class="navmenu">{LOGOUT_LNK}</a></li>
<!-- END logout -->
                                        </ul>

EOT;

// HTML template for sub menu
$template_sub_menu = <<<EOT
                                        <ul>
<!-- BEGIN home -->
                                            <li><a href="{HOME_TGT}" title="{HOME_TITLE}" class="navmenu">{HOME_LNK}</a></li>
<!-- END home -->
<!-- BEGIN custom_link -->
                                            <li><a href="{CUSTOM_LNK_TGT}" title="{CUSTOM_LNK_TITLE}" class="navmenu">{CUSTOM_LNK_LNK}</a></li>
<!-- END custom_link -->
<!-- BEGIN album_list -->
                                            <li><a href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}" class="navmenu">{ALB_LIST_LNK}</a></li>
<!-- END album_list -->
                                            <li><a href="{LASTUP_TGT}" title="{LASTUP_LNK}" class="navmenu">{LASTUP_LNK}</a></li>
                                            <li><a href="{LASTCOM_TGT}" title="{LASTCOM_LNK}" class="navmenu">{LASTCOM_LNK}</a></li>
                                            <li><a href="{TOPN_TGT}" title="{TOPN_LNK}" class="navmenu">{TOPN_LNK}</a></li>
                                            <li><a href="{TOPRATED_TGT}" title="{TOPRATED_LNK}" class="navmenu">{TOPRATED_LNK}</a></li>
                                            <li><a href="{SEARCH_TGT}" title="{SEARCH_LNK}" class="navmenu">{SEARCH_LNK}</a></li>
                                        </ul>

EOT;

// HTML template for gallery admin menu
$template_gallery_admin_menu = <<<EOT

                    <ul>
<!-- BEGIN admin_approval -->
                            <li id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}" class="navmenu">{UPL_APP_LNK}</a></li>
<!-- END admin_approval -->
                            <li><a href="admin.php" title="{ADMIN_TITLE}" class="navmenu">{ADMIN_LNK}</a></li>
                            <li><a href="catmgr.php" title="{CATEGORIES_TITLE}" class="navmenu">{CATEGORIES_LNK}</a></li>
                            <li><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}" class="navmenu">{ALBUMS_LNK}</a></li>
                            <li><a href="groupmgr.php" title="{GROUPS_TITLE}" class="navmenu">{GROUPS_LNK}</a></li>
                            <li><a href="usermgr.php" title="{USERS_TITLE}" class="navmenu">{USERS_LNK}</a></li>
                            <li><a href="banning.php" title="{BAN_TITLE}" class="navmenu">{BAN_LNK}</a></li>
                            <li><a href="reviewcom.php" title="{COMMENTS_TITLE}" class="navmenu">{COMMENTS_LNK}</a></li>
<!-- BEGIN log_ecards -->
                            <li><a href="db_ecard.php" title="{DB_ECARD_TITLE}" class="navmenu">{DB_ECARD_LNK}</a></li>
<!-- END log_ecards -->
                            <li><a href="picmgr.php" title="{PICTURES_TITLE}" class="navmenu">{PICTURES_LNK}</a></li>
                            <li><a href="searchnew.php" title="{SEARCHNEW_TITLE}" class="navmenu">{SEARCHNEW_LNK}</a></li>
                            <li><a href="util.php" title="{UTIL_TITLE}" class="navmenu">{UTIL_LNK}</a></li>
                            <li><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}" class="navmenu">{MY_PROF_LNK}</a></li>
<!-- BEGIN documentation -->
                            <li><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation" class="navmenu">{DOCUMENTATION_LNK}</a></li>
<!-- END documentation -->
                    </ul>

EOT;
// HTML template for user admin menu
$template_user_admin_menu = <<<EOT

                        <ul>
                                <li><a href="albmgr.php" title="{ALBMGR_TITLE}" class="navmenu">{ALBMGR_LNK}</a></li>
                                <li><a href="modifyalb.php" title="{MODIFYALB_TITLE}" class="navmenu">{MODIFYALB_LNK}</a></li>
                                <li><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}" class="navmenu">{MY_PROF_LNK}</a></li>
                                <li><a href="picmgr.php" title="{PICTURES_TITLE}" class="navmenu">{PICTURES_LNK}</a></li>
                        </ul>

EOT;

// Function to display first level Albums of a category
function theme_display_album_list_cat(&$alb_list$nbAlb$cat$page$total_pages)
{
    global 
$CONFIG$STATS_IN_ALB_LIST$statistics$template_tab_display$template_album_list_cat$lang_album_list;
    if (!
$CONFIG['first_level']) {
        return;
    }

    
$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 '&amp;page=%d'));

    
$tabs create_tabs($nbAlb$page$total_pages$theme_alb_list_tab_tmpl);
    
// echo $template_album_list_cat;
    
$template_album_list_cat1 $template_album_list_cat;
    
$album_cell template_extract_block($template_album_list_cat1'c_album_cell');
    
$empty_cell template_extract_block($template_album_list_cat1'c_empty_cell');
    
$tabs_row template_extract_block($template_album_list_cat1'c_tabs');
    
$stat_row template_extract_block($template_album_list_cat1'c_stat_row');
    
$spacer template_extract_block($template_album_list_cat1'c_spacer');
    
$header template_extract_block($template_album_list_cat1'c_header');
    
$footer template_extract_block($template_album_list_cat1'c_footer');
    
$rows_separator template_extract_block($template_album_list_cat1'c_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 == && $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;
}

function 
theme_main_menu($which)
{
    global 
$AUTHORIZED$CONFIG$album$actual_cat$cat$REFERER;
    global 
$lang_main_menu$template_sys_menu$template_sub_menu;


    static 
$sys_menu ''$sub_menu '';
    if ($
$which != '') {
        return $
$which;
    }

    
$album_l = isset($album) ? "?album=$album'';
    
$cat_l = (isset($actual_cat))? "?cat=$actual_cat: (isset($cat) ? "?cat=$cat'');
    
$cat_l2 = isset($cat) ? "&amp;cat=$cat'';
    
$my_gallery_id FIRST_USER_CAT USER_ID;



  if (
$which == 'sys_menu' ) {
    if (
USER_ID) {
        
template_extract_block($template_sys_menu'login');
    } else {
        
template_extract_block($template_sys_menu'logout');
        
template_extract_block($template_sys_menu'my_profile');
    }

    if (!
USER_IS_ADMIN) {
        
template_extract_block($template_sys_menu'enter_admin_mode');
        
template_extract_block($template_sys_menu'leave_admin_mode');
    } else {
        if (
GALLERY_ADMIN_MODE) {
            
template_extract_block($template_sys_menu'enter_admin_mode');
        } else {
            
template_extract_block($template_sys_menu'leave_admin_mode');
        }
    }

    if (!
USER_CAN_CREATE_ALBUMS) {
        
template_extract_block($template_sys_menu'my_gallery');
    }

    if (
USER_CAN_CREATE_ALBUMS) {
        
template_extract_block($template_sys_menu'my_profile');
    }

    if (!
USER_CAN_UPLOAD_PICTURES) {
        
template_extract_block($template_sys_menu'upload_pic');
    }

    if (
USER_ID || !$CONFIG['allow_user_registration']) {
        
template_extract_block($template_sys_menu'register');
    }

    if (!
USER_ID || !$CONFIG['allow_memberlist']) {
        
template_extract_block($template_sys_menu'allow_memberlist');
    }

    if (!
$CONFIG['display_faq']) {
        
template_extract_block($template_sys_menu'faq');
    }

    
$param = array(
        
'{MY_GAL_TGT}' => "index.php?cat=$my_gallery_id",
        
'{MY_GAL_TITLE}' => $lang_main_menu['my_gal_title'],
        
'{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'],
        
'{MEMBERLIST_TGT}' => "usermgr.php",
        
'{MEMBERLIST_TITLE}' => $lang_main_menu['memberlist_title'],
        
'{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'],
        
'{FAV_TGT}' => "thumbnails.php?album=favpics",
        
'{FAV_TITLE}' => $lang_main_menu['fav_title'],
        
'{FAV_LNK}' => $lang_main_menu['fav_lnk'],
        
'{MY_PROF_TGT}' => "profile.php?op=edit_profile",
        
'{MY_PROF_TITLE}' => $lang_main_menu['my_prof_title'],
        
'{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'],
        
'{ADM_MODE_TGT}' => "mode.php?admin_mode=1&amp;referer=$REFERER",
        
'{ADM_MODE_TITLE}' => $lang_main_menu['adm_mode_title'],
        
'{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'],
        
'{USR_MODE_TGT}' => "mode.php?admin_mode=0&amp;referer=$REFERER",
        
'{USR_MODE_TITLE}' => $lang_main_menu['usr_mode_title'],
        
'{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'],
        
'{UPL_PIC_TGT}' => "upload.php",
        
'{UPL_PIC_TITLE}' => $lang_main_menu['upload_pic_title'],
        
'{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'],
        
'{REGISTER_TGT}' => "register.php",
        
'{REGISTER_TITLE}' => $lang_main_menu['register_title'],
        
'{REGISTER_LNK}' => $lang_main_menu['register_lnk'],
        
'{LOGIN_TGT}' => "login.php?referer=$REFERER",
        
'{LOGIN_TITLE}' => $lang_main_menu['login_title'],
        
'{LOGIN_LNK}' => $lang_main_menu['login_lnk'],
        
'{LOGOUT_TGT}' => "logout.php?referer=$REFERER",
        
'{LOGOUT_TITLE}' => $lang_main_menu['logout_title'],
        
'{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" USER_NAME "]",
        
'{FAQ_TGT}' => "faq.php",
        
'{FAQ_TITLE}' => $lang_main_menu['faq_title'],
        
'{FAQ_LNK}' => $lang_main_menu['faq_lnk'],
        );

        
$sys_menu template_eval($template_sys_menu$param);
  } else {

    if (!
$CONFIG['custom_lnk_url']) {
        
template_extract_block($template_sub_menu'custom_link');
    }

    
$param = array(
        
'{HOME_TGT}' => $CONFIG['home_target'],
        
'{HOME_TITLE}' => $lang_main_menu['home_title'],
        
'{HOME_LNK}' => $lang_main_menu['home_lnk'],
        
'{ALB_LIST_TGT}' => "index.php$cat_l",
        
'{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
        
'{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
        
'{CUSTOM_LNK_TGT}' => $CONFIG['custom_lnk_url'],
        
'{CUSTOM_LNK_TITLE}' => $CONFIG['custom_lnk_name'],
        
'{CUSTOM_LNK_LNK}' => $CONFIG['custom_lnk_name'],
        
'{LASTUP_TGT}' => "thumbnails.php?album=lastup$cat_l2",
        
'{LASTUP_TITLE}' => $lang_main_menu['lastup_title'],
        
'{LASTUP_LNK}' => $lang_main_menu['lastup_lnk'],
        
'{LASTCOM_TGT}' => "thumbnails.php?album=lastcom$cat_l2",
        
'{LASTCOM_TITLE}' => $lang_main_menu['lastcom_title'],
        
'{LASTCOM_LNK}' => $lang_main_menu['lastcom_lnk'],
        
'{TOPN_TGT}' => "thumbnails.php?album=topn$cat_l2",
        
'{TOPN_TITLE}' => $lang_main_menu['topn_title'],
        
'{TOPN_LNK}' => $lang_main_menu['topn_lnk'],
        
'{TOPRATED_TGT}' => "thumbnails.php?album=toprated$cat_l2",
        
'{TOPRATED_TITLE}' => $lang_main_menu['toprated_title'],
        
'{TOPRATED_LNK}' => $lang_main_menu['toprated_lnk'],
        
'{SEARCH_TGT}' => "search.php",
        
'{SEARCH_TITLE}' => $lang_main_menu['search_title'],
        
'{SEARCH_LNK}' => $lang_main_menu['search_lnk'],
        );
    
$sub_menu template_eval($template_sub_menu$param);
  }

    return $
$which;
}


?>
« Last Edit: August 03, 2006, 02:30:33 pm by JesseLeeStringer »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Add a link to download compressed albums
« Reply #7 on: August 03, 2006, 02:16:59 pm »

do as Paver suggested:
copy it (theme_display_thumbnails function )from the themes/sample/theme.php if you don't have it already and then change the function the way he said
Logged
‍I don't answer to PM with support question
Please post your issue to related board

JesseLeeStringer

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Add a link to download compressed albums
« Reply #8 on: August 03, 2006, 02:34:37 pm »

For the best of my knowledge  ???
I believe I have.. Having said that,

I have copied the following lines

Code: [Select]
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
    global $CONFIG;
    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;

    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';

    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }

    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    $uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' . $_GET['uid'] : '';

    $theme_thumb_tab_tmpl = $template_tab_display;

    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }

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

    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        $title = template_eval($template_thumb_view_title_row, $param);
    } else if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       $param = array('{ALBUM_NAME}' => $album_name,
                             '{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       $title = template_eval($template_fav_thumb_view_title_row, $param);
    }else{
        $title = $album_name;
    }


    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }

    echo $header;

    $i = 0;
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                $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}' => $thumb['admin_menu']
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        }
        echo template_eval($thumb_cell, $params);

        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
    }
    for (;($i % $thumbcols); $i++) {
        echo $empty_cell;
    }
    echo $footer;

    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }

    endtable();
    echo $spacer;
}

Into themes/reynolds/theme.php
as posted prior.

Does the function allowable to sit ANYWHERE within the theme.php file (I'm unsure if there is a hierarchy of parsing)
or does it have to be within $admin_menu ect.

Still confused sorry :-\
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Add a link to download compressed albums
« Reply #9 on: August 03, 2006, 03:23:51 pm »

you didn't add:
Code: [Select]
// MOD - begin
$param['{ALBUM_NAME}'] .= ' - <a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $album_name . '.rar">Download all the pictures of this album in a compress file</a>';
// MOD - end
to that function !!!
okey here is moded function , delete your old theme_display_thumbnails function from theme.php and paste this new one:
Code: [Select]
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
    global $CONFIG;
    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;

    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';

    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }

    $cat_link = is_numeric($aid) ? '' : '&amp;cat=' . $cat;
    $uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' . $_GET['uid'] : '';

    $theme_thumb_tab_tmpl = $template_tab_display;

    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&amp;page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    }

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

    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        // MOD - begin
$param['{ALBUM_NAME}'] .= ' - <a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $album_name . '.rar">Download all the pictures of this album in a compress file</a>';
// MOD - end
$title = template_eval($template_thumb_view_title_row, $param);
    } else if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       $param = array('{ALBUM_NAME}' => $album_name,
                             '{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       $title = template_eval($template_fav_thumb_view_title_row, $param);
    }else{
        $title = $album_name;
    }


    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }

    echo $header;

    $i = 0;
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                $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}' => $thumb['admin_menu']
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        }
        echo template_eval($thumb_cell, $params);

        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
    }
    for (;($i % $thumbcols); $i++) {
        echo $empty_cell;
    }
    echo $footer;

    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }

    endtable();
    echo $spacer;
}
Logged
‍I don't answer to PM with support question
Please post your issue to related board

JesseLeeStringer

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Add a link to download compressed albums
« Reply #10 on: August 08, 2006, 11:46:01 am »

My apologies for the time taken to respond bmossavari,
I just realised that I had made a few adjustments to the code prior to adding your appropriate coding.
Got it all fixed now.
Thank You
Logged

MaRRocK

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Add a link to download compressed albums
« Reply #11 on: August 30, 2006, 12:29:27 pm »

Hello, I am also interested by the "download compressed albums "
I added with the “displayimage.php”

Code: [Select]
$info['Download'] = '<a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $CURRENT_ALBUM_DATA['title'] . '.zip">Dowload all the pictures of this album in a compress file</a>';

It's perfect, the zip file has to be made and uploaded manually.
But the problem it is that to allot a file name automatically, $CURRENT_ALBUM_DATA['title'] is used, which will add the name of the current album by respecting breakage…
with my examples “Temple d'Edfou” or “Edfou à Philae”, i will have the same zip file name.
what I would have liked to do is to break this breakage, to put all into lowercase, to replace them " " by "_ " and to transform the accents.

For lowercase :
Code: [Select]
$name_album = strtolower($CURRENT_ALBUM_DATA['title']);
$info['Download'] = '<a href=" '. $CONFIG["ecards_more_pic_target"] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $name_album . '.zip">Download all the pictures of this album in a compress file</a>';

But impossible to remove the ' and the accent "à" in spite of the use of “str_replace ()”, “strtr ()”, and others.
Do you have an idea to arrive at my ends ?

Sorry for the bad English...

MaRRocK
« Last Edit: August 31, 2006, 11:51:34 am by MaRRocK »
Logged

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Add a link to download compressed albums
« Reply #12 on: January 03, 2007, 10:49:56 am »

Hello guy's

In replay #4 your talking about a "zip.php" file.
Did you mean the zipdownload.php file or is this a selfprogrammed file or i am still too stupid to find it?  ;D

If this is a new file, could someone send this to me? Would be very nice :)

Second question:
In the solution of Paver in replay #4 i have to upload the zip file manually too or does this mysterious zip.php generate the zip file?


best regards
Henrik Ziegenhain
Logged
Pages: [1]   Go Up
 

Page created in 0.036 seconds with 20 queries.