Download complete album als ZIP - Page 2 Download complete album als ZIP - Page 2
 

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

Download complete album als ZIP

Started by Finswimmer, January 18, 2012, 09:33:00 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

fersauce

@Finswimmer

Hello.
Thank you for your contribution.

Its´s posible to show a message while script is creating the zip file? Something like " wait a moment please" 

Thank you

Tatome

Hi,

not much seems to have happened on this one, lately.  In particular I don't find the plugin in the repo. 

I'd really appreciate the functionality, but I can't get it to work: first, when I install the last version in this thread, I get
Fatal error: require(): Failed opening required './plugins/albumdownload/lang/english.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/coppermine/plugins/albumdownload/initialize.inc.php on line 6
With an empty english.php in the lang directory, nothing happens at all---the thumbnail view is unchanged from without the plugin.

Does anyone have any ideas how to fix this?

Cheers,
Johannes

PS: Kudos for implementing it in the first place, Finswimmer!

Αndré

Quote from: Tatome on May 07, 2012, 10:35:02 AM
With an empty english.php in the lang directory, nothing happens at all---the thumbnail view is unchanged from without the plugin.
When I install the plugin with an empty english.php language file the word "zip" is appended to the album name. A short look at the code shows, that it will not added for meta albums:
if ($superCage->get->getInt('album') > 0) {


However, when I open the URL I just get an error like
QuoteFatal error: Class 'zip_file' not found in C:\xampplite\htdocs\svn_cpg15x_trunk\plugins\albumdownload\albumZip.php on line 42

To fix that issue, open albumZip.php, find
include('../../include/archive.php');
and replace with
include('include/archive.php');

Tatome

Thanks, Αndré.  At first, I didn't see any change, but after I actually put something meaningful into english.php:
<?php
if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...'); }
$lang_plugin_albumdownload = array(
        
'albumDownload' => 'Download Album as ZIP file.'
    
);
?>

it seemed to work.  "seemed", because, when I clicked the link, I got a list of files (presumably the zip file preamble), and
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3230366 bytes) in /var/www/coppermine/include/archive.php on line 651

Presumably this is because the zip file is built in-memory.  So, nothing we can do about this save re-implement the whole thing?

Cheers,
Johannes

Αndré

Quote from: Tatome on May 07, 2012, 02:29:01 PM
Presumably this is because the zip file is built in-memory.  So, nothing we can do about this save re-implement the whole thing?
You could try to apply that changes to the albumZip.php file.

Tatome

That would be a change to a file in the coppermine distribution as oppose to something in the plugin, right?

Thanks again, I'll check it out when I'm home.

Tatome

Quote from: Αndré on May 07, 2012, 03:02:42 PM
You could try to apply that changes to the albumZip.php file.

Never mind my last comment.

Wer lesen kann...

Tatome

That kind of worked.  I get a different error now:
Maximum execution time of 60 seconds exceeded in /var/www/coppermine/include/archive.php on line 65

This probably means I have to change my php settings.  I'll try it out when I get home.

Cheers,
Johannes

Αndré

It should also be possible to distribute the zip file creation to bypass the execution limit, e.g. just add 5 files at a time to the archive and then start the script from the beginning.

Tatome

Interesting idea...

You mean like the bulk image update functions: the user would click for each batch of images being added to the archive? 

Or would it even be possible to keep the restart transparent to the user?

Cheers,
Johannes

Tatome

Hi,

I fixed the code and it works in my installation.  I think I even improved it somewhat such that not only those images are included in the archive whose `home' album is the album in question, but also those included via the album tag.

Can I upload my version of the plugin?  How about the copyright?

Cheers,
Johannes

Αndré

Please share your version with the community.

Tatome

Oops, sorry, I made it sound like I was concerned about my copyright.  Of course I'll gladly share what little contribution I can make.

I was referring to the OP's copyright.  After all, it's still mostly his code.

Cheers,
Johannes

Finswimmer

Quote from: Tatome on May 08, 2012, 03:55:24 PM
Oops, sorry, I made it sound like I was concerned about my copyright.  Of course I'll gladly share what little contribution I can make.

I was referring to the OP's copyright.  After all, it's still mostly his code.

Cheers,
Johannes

It is ok as long as it remains "opensource". All changes must be contributed with this forum.

Thank you for your improvements!

Tatome

Here goes.

BTW: I don't think there's anything in this plugin that checks user permissions, is there?

Αndré

Quote from: Tatome on May 09, 2012, 01:06:10 PM
I don't think there's anything in this plugin that checks user permissions

Correct, but should be quite easy by replacing
$result = cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = " . $aid );
with something like
$result = cpg_db_query("SELECT filepath, filename FROM {$CONFIG['TABLE_PICTURES']} $RESTRICTEDWHERE AND r.aid = " . $aid );
in albumZip.php (not tested).

Tatome

Cool, thanks.  I'll check it out.

Of course that's only making it difficult to get the images, not impossible, for anyone who doesn't have access rights, as long as full size images are served directly.  But there's a plugin that serves images after checking access rights as well, right?

Αndré

I just added the plugin to our SVN repository and currently merging your contribution. So please don't improve your current code until I submitted the new version to the repository.

Tatome

"Don't improve your code..."
That's a tough request, you know  ;-)

Αndré

Quote from: Αndré on May 09, 2012, 02:15:37 PM
until
... ;) I just wanted to avoid unnecessary merging effort.


Latest plugin version can be downloaded here. Please use it for further improvements. I'll add any contributed improvements to the repository.