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] 2 3   Go Down

Author Topic: Download an album by zip  (Read 90326 times)

0 Members and 1 Guest are viewing this topic.

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Download an album by zip
« on: May 03, 2007, 06:06:17 pm »

Hello guys,

as requested in this thread i´ll post my modification here.

Remember: Propably full of bugs and non-professional code. Feel free to improve it :)

What does it do?
It simply adds a button/text to your thumbnails.php to download a complete album as a zip archive without the normal_ and thumb_ pictures.

What to do?
1. Download the attached file
2. unzip and Edit line 13 in zip.php (`cpg143_pictures`)
2. upload the zip.php to your coppermine root
3. modify the theme.php from your current theme as the following

find:
Code: [Select]
    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'],
            );

replace with:
Code: [Select]
    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="zip.php?aid=' . $aid . '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end

Thats it. I´ll hope you have fun with it :)
« Last Edit: May 03, 2007, 06:28:52 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Download an album by zip
« Reply #1 on: May 03, 2007, 06:25:55 pm »

Where does pclzip.lib.php come from?

Note: use this mod at your own risk...
Logged

Beme

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
..
« Reply #2 on: May 06, 2007, 09:03:51 pm »

Hello,

thank you h3nn3s for posting your mod. But it doesn't fit to version 1.4.10. I think you use an minor version? The layout of the theme.php in the latest version seems to be completely different. In theme.php I don't have access to the variable "$aid" either.

Benjamin
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Download an album by zip
« Reply #3 on: May 07, 2007, 08:39:59 am »

@Beme: your comment doesn't apply. As with all theme modifications, you'll need to copy the missing code from the sample theme into your custom theme if it doesn't exist there.



@all:

If the above mentioned section doesn't exist in themes/your_theme/theme.php, then copy
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 . $uid_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 . $uid_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 . $uid_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']}$uid_link",
                    '{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;
}
from themes/sample/theme.php into a new line before
Code: [Select]
?>of themes/your_theme/theme.php, then apply the suggested modification.
Logged

alexo

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Download an album by zip
« Reply #4 on: May 07, 2007, 09:17:28 am »

Here you can find details regarding pclzip :
http://www.phpconcept.net/pclzip/man/en/index.php?methods-delete
Logged

Beme

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Download an album by zip
« Reply #5 on: May 07, 2007, 06:35:24 pm »

Thanks to GauGau and alexo for your help!  :)

If there's anybody here, who not wants to display a Downloadlink, but wants to force the clients browser to download the zipped file directly, search in zip.php:

Code: [Select]
echo "Downloadlink: <a href=\"" . $aid . ".zip\">" . $aid . ".zip</a>";
and replace it with:

Code: [Select]
$file = $aid.".zip";
$filename = basename($file);
$size = filesize($file);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".$filename);
header("Content-Length:".$size);
readfile($file);

Logged

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Download an album by zip
« Reply #6 on: May 07, 2007, 06:47:33 pm »

thanks to gaugau for the quick help and to Beme for the automatic download, i`ve added it too :)
Logged

subgr

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Download an album by zip
« Reply #7 on: May 21, 2007, 03:47:51 am »

Hi guys,
I always wanted to have the functionality to download the whole album and h3nn3s way was a good starting point. Because I had some problems with that I created something else.
I have modified gaugau’s zipdownload.php which is used to download the favourites as zip to work for downloading whole albums and the zip file to have the name of the album.

Instructions:
  • Download attached file and extract zipalbum.php in the root directory of coppermine.
  • Make sure that you have “Allow ZIP-download of favourites” at “General settings” enabled.
  • Modify the theme.php from your current theme as follows.

Code: [Select]
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);

Code: [Select]
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 start
if ($CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
$param['{ALBUM_NAME}'].= '&nbsp;&nbsp;<a href="zipalbum.php?album_d='.$aid.'">Download as Zip file'.$ALBUM_SET_ARRAY[0].'</a>';
}
//my mod end
        $title = template_eval($template_thumb_view_title_row, $param);

Logged

subgr

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Download an album by zip
« Reply #8 on: May 21, 2007, 04:07:29 am »

Oops by mistake I posted before I finished and I can’t edit it.  ::)
The modification at the post above is wrong. This is the right one:

Code: [Select]
//mod start
if ($CONFIG['enable_zipdownload'] == 1) {
$param['{ALBUM_NAME}'].= '&nbsp;&nbsp;<a href="zipalbum.php?album_d='.$aid.'">Download as Zip file</a>';
}
//mod end

The benefits of zipalbum.php are that you don’t have to modify it to work in your installation and creates the zip file with the already included coppermine functions.
There was an issue with spaces at the albums name's, thats why spaces are being replaced by "_".
I hope it is ok with you gaugau that zipalbum.php is based on your code, otherwise I will remove it.
Logged

ventom

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • My Prom Album - Post Your Prom Photos
Re: Download an album by zip
« Reply #9 on: June 07, 2007, 11:04:20 pm »

Hello guys,

as requested in this thread i´ll post my modification here.

Remember: Propably full of bugs and non-professional code. Feel free to improve it :)

What does it do?
It simply adds a button/text to your thumbnails.php to download a complete album as a zip archive without the normal_ and thumb_ pictures.

What to do?
1. Download the attached file
2. unzip and Edit line 13 in zip.php (`cpg143_pictures`)
2. upload the zip.php to your coppermine root
3. modify the theme.php from your current theme as the following

find:
Code: [Select]
    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'],
            );

replace with:
Code: [Select]
    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="zip.php?aid=' . $aid . '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end

Thats it. I´ll hope you have fun with it :)


Great post. It only needed 1 additional line of code in zip.php to make it run without errors:
 
Code: [Select]
$aid = $_GET['aid'];
Logged

Vincs

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 55
Re: Download an album by zip
« Reply #10 on: June 09, 2007, 04:28:17 pm »

I can't make it works with my version 1.4.10 and chaoticsoul template... I can't find where I must add the line in theme.php
Logged

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Download an album by zip
« Reply #11 on: June 10, 2007, 04:09:47 pm »

I can't make it works with my version 1.4.10 and chaoticsoul template... I can't find where I must add the line in theme.php

look at this

@Beme: your comment doesn't apply. As with all theme modifications, you'll need to copy the missing code from the sample theme into your custom theme if it doesn't exist there.



@all:

If the above mentioned section doesn't exist in themes/your_theme/theme.php, then copy
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 . $uid_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 . $uid_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 . $uid_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']}$uid_link",
                    '{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;
}
from themes/sample/theme.php into a new line before
Code: [Select]
?>of themes/your_theme/theme.php, then apply the suggested modification.
Logged

Vincs

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 55
Re: Download an album by zip
« Reply #12 on: June 10, 2007, 05:02:35 pm »

When I do the modification and try to download an album I got this

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 207835 bytes) in /mnt/106/sdb/1/5/site/include/archive.php on line 445


Logged

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Download an album by zip
« Reply #13 on: June 10, 2007, 06:04:26 pm »

your memory size of PHP is limited to 32MB. You may have to edit the php.ini file to increase the memory size which can be used by PHP.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

h3nn3s

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: Download an album by zip
« Reply #15 on: June 11, 2007, 08:14:42 pm »

jep thanks, that's what i would say :D
Logged

dieapokalypse

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Download an album by zip
« Reply #16 on: June 13, 2007, 06:51:14 pm »

look at this


I do the same: copie the missing code of the function

function theme_display_thumbnails

at the end of my theme-code (above ?>), but then my gallery is empty (white)

I'm Using the macox-theme...can somebody help me

Logged

michi4ever

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Delete ZIP Files after Downloaded
« Reply #17 on: June 25, 2007, 06:20:13 pm »

Hello,

the function above is great! (with zip.php).
But, when a zip-file is downloaded, there is a "number of album".zip in the coppermine root.

Is there a way, that after the zip is downloaded, the zip file will be deleted? maybe with a cronjob?

Thanks in advance,

Mike
Logged

zymme

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Download an album by zip
« Reply #18 on: August 04, 2007, 05:00:19 pm »

Please fill me in with more info, what should I type in, in the zip.php file?
"2. unzip and Edit line 13 in zip.php (`cpg143_pictures`)"
I Don´t understand:)

Thanks!


Hello guys,

as requested in this thread i´ll post my modification here.

Remember: Propably full of bugs and non-professional code. Feel free to improve it :)

What does it do?
It simply adds a button/text to your thumbnails.php to download a complete album as a zip archive without the normal_ and thumb_ pictures.

What to do?
1. Download the attached file
2. unzip and Edit line 13 in zip.php (`cpg143_pictures`)
2. upload the zip.php to your coppermine root
3. modify the theme.php from your current theme as the following

find:
Code: [Select]
    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'],
            );

replace with:
Code: [Select]
    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="zip.php?aid=' . $aid . '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end

Thats it. I´ll hope you have fun with it :)

Logged

Nibbler

  • Guest
Re: Download an album by zip
« Reply #19 on: August 04, 2007, 05:20:41 pm »

Change to the prefix you chose during installation. Check include/config.inc.php or your database if you can't remember.
Logged
Pages: [1] 2 3   Go Up
 

Page created in 0.034 seconds with 20 queries.