forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: Fabricio Ferrero on September 27, 2008, 03:50:03 am

Title: How to add a file inside the zip favourite download?
Post by: Fabricio Ferrero on September 27, 2008, 03:50:03 am
Hi,

I set "allow favourites zip downloading" and work perfect.
I was wondering if there is any way to add a file (as a txt) to the zip so when the users download his favourites pictures, he also get a txt inside that zip file. Has anybody did this before and would like to share?

P.S: I don't know if this is already requested but would be an excelent feature for 1.5 imo.
Title: Re: How to add a file inside the zip favourite download?
Post by: Joachim Müller on September 27, 2008, 08:47:59 am
As far as I know this has not been coded yet. I'm not sure if it should go into a release, as zip download is a feature that is bound to break for larger downloads anyway, since zip-creation on the server is a resources intensive process that fails easily.
To come up with this, you need to review zipdownload.php (in the coppermine root): before the start of the loop, you need to add the text file to the list. To keep things easy and avoid dynamic creation of the text files, create the text file in advance. Let's assume that you have already created the textfile named "readme.txt" within your albums folder. Find
Code: [Select]
if (count($FAVPICS)>0){and add after it (in a line of it's own)
Code: [Select]
        $filelist[] = $CONFIG['fullpath'].'readme.txt';Please keep in mind that I have coded this out of the back of my head without testing it, so please report back.
Title: Re: How to add a file inside the zip favourite download?
Post by: Nibbler on September 27, 2008, 12:24:53 pm
Should be just:

Code: [Select]
$filelist[] = 'readme.txt';
Title: Re: How to add a file inside the zip favourite download?
Post by: Joachim Müller on September 27, 2008, 01:18:09 pm
I stand corrected. I have added this feature to cpg1.5.x, as it was easily accomplished.
Title: Re: How to add a file inside the zip favourite download?
Post by: Fabricio Ferrero on September 28, 2008, 04:52:30 am
Reporting back...

Both solutions works as expected. I choose Nibbler's one because it's shorter and works as well too.

Adding this to 1.5 it's great. I think almost all users that allow zip downloading would love this feature, don't you think? So thanks to considering this. I will not create a topic in feature request, it's sensless. But, maybe you should consider moving this to mod sub-forum.

Ok, once again, thank both of you very much to come up with a solution in no time. I would love have coding skills but I don't.  :'(

Thanks,