[module / downloadalbum] feedbacks & bugreport

ondex

Joined: 2009-04-30
Posts: 40
Posted: Tue, 2010-07-13 20:23

What is "downloadalbum" ?
This module allows you to provide a link to download a ZIP archive of the current album.
More details : http://codex.gallery2.org/Gallery3:Modules:downloadalbum

Download
The module is on the official gallery3-contrib : http://github.com/gallery/gallery3-contrib/tree/master/3.0/modules/downloadalbum/
The lastest code is on my repository : http://github.com/rledisez/gallery3-contrib/tree/master/3.0/modules/downloadalbum/

Know bugs
* Filenames with specials chars (éèà...) are incorrectly uncompressed with the default Windows-Unarchiver : it is a Windows bug (OK on Linux and Mac OS X)

Changelog
2010-07-15 : Fix the bug of special char on Linux
2010-07-22 : Workaround for a PHP bug ( http://bugs.php.net/bug.php?id=45028 )
2010-07-22 : Workaround for an MSIE bug ( http://support.microsoft.com/kb/323308/en-us )
2010-10-27 : Fix the bug when downloading the entire gallery, file downloaded was named '.zip'
2010-10-27 : Add support for download by tags (an idea of carlstreeter, thanks for the patch)
2010-10-27 : When error occur, now throw an exception so there is an error message on screen instead of an empty-white screen
2010-11-24 : Fix the bug "invalid CRC", it only happened on 32 bits servers
2010-12-18 : Fix a bug with Windows servers (directory separator was not properly handled)
2011-04-24 : Create a new permission "downloadalbum". You can now choose to allow or disallow download of an album per (album,group). Default is "disallow", so just after upgrading from version 2 nobody will be able to download until you allow it.
2011-04-24 : Show the "Download album" link only if there is something to download (see the commit message for limitation)
2012-12-29 : Fix a bug about output buffering. Only PHP 5.4+ was affected. (commit)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2010-07-13 23:29

Thanks and thanks for creating the codex page.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Thu, 2010-07-15 11:35

WOW! Finally something works with Arabic names... after a lot of waiting for DownloadArchive Module bug to get fixed. Just wondering if you can add the choice of using the resized versions rather than the full-sized ones?

Thanks :)!

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Thu, 2010-07-15 16:48
Quote:
Just wondering if you can add the choice of using the resized versions rather than the full-sized ones?

Can you explain little bit more what you need ?

Do you want that the admin only allows downloads of resized versions ? Do you want that the end-user is able to choose between fullsized version or resized version ? Or, do you want that the downloaded version depends on the right of the end-user (fullsized version if the end user has right to view the full version) ?

Or something else...

 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Sat, 2010-07-17 06:30

The best for me, and I think for others, is #2, which gives the option to the end-user.. since it depends on the situation (what does the user need now, what is the speed of his internet connection in case the full-sized version have huge sizes, etc.) My idea is to make a simple dialogue window like the one appears in GitHub.com when you click to download source code files. The window will simply ask the end-user about the image sizes he wants, and another options if available (I am thinking of making the including of sub-albums as an option, too.) Then the zip archive will be generated according to the selected options. The module would be super awesome if that really happened :)!

If that isn't easy to implement then I find the admin options is better than depending on the user permissions, but it's just a personal preferring.

Many thanks :)!

 
skysober@hotmail.com

Joined: 2010-07-18
Posts: 2
Posted: Sun, 2010-07-18 08:31

Looks GREAT! I just wish it had a hook in it for Paypal and it would be a perfect mod for use on a photo pay site!

 
erwinquek

Joined: 2010-07-19
Posts: 4
Posted: Mon, 2010-07-19 07:26

Hi, installed module and it works great on Firefox and Safari.

However, it does not work with IE 8.

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Mon, 2010-07-19 08:03
erwinquek wrote:
However, it does not work with IE 8.

I'm running IE8 without problems. What happened during your test ? Is there anything in var/logs/ ?

mamouneyya wrote:
Just wondering if you can add the choice of using the resized versions rather than the full-sized ones?

I started working on it. Nothing commited yet.

 
erwinquek

Joined: 2010-07-19
Posts: 4
Posted: Mon, 2010-07-19 08:18
Quote:
I'm running IE8 without problems. What happened during your test ? Is there anything in var/logs/ ?

Did not have a chance to check the logs as I am presently out. I am using https ... does that matter?

Have u tested running it under https?

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Mon, 2010-07-19 08:40
erwinquek wrote:
Have u tested running it under https?

You're right. It doesn't work over SSL with IE8. Added to the list of known bugs.

 
deeegee

Joined: 2010-06-22
Posts: 6
Posted: Thu, 2010-07-22 18:15

Hi,
is there an upcoming solution for the problem with the special chars?

Best wishes Daniel

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Thu, 2010-07-22 18:44
deeegee wrote:
is there an upcoming solution for the problem with the special chars?

No, because it is a Windows bug. The ZIP component of Windows doesn't handle UTF-8 encoding in ZIP. It is normalized since version 6.3 of the ZIP format, which was published in september 2006. Honestly, I only tested it on Windows XP, may be Windows 7 comes with an updated ZIP component.

BTW: the problem with HTTPS will be fixed soon. I am testing the modification I made to the code.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2010-07-22 18:48
Quote:
No, because it is a Windows bug. The ZIP component of Windows doesn't handle UTF-8 encoding in ZIP. It is normalized since version 6.3 of the ZIP format, which was published in september 2006. Honestly, I only tested it on Windows XP, may be Windows 7 comes with an updated ZIP component.

And if that's the case, there are lots of free (and better) zip programs. 7-Zip www.7-zip.org, for one. You can also pay the piper can go for Winzip or Winrar. I could be wrong, but I believe Winrar has a free version/component if you just need to be able to unzip.

If it's effecting your users, then educate and send them to 7-zip.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Thu, 2010-07-22 21:08
ondex wrote:
It doesn't work over SSL with IE8

Fixed. Just wait for bharat to pull my commit in the official repo.

 
deeegee

Joined: 2010-06-22
Posts: 6
Posted: Fri, 2010-07-23 09:02

Hi I tried it with windows 7 64bit german version and 7-zip it's not working...
Does somebody know a zip programm which is working?

Best wishes
Daniel

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2010-07-23 15:41

Did you happen to try the 64bit beta?

http://downloads.sourceforge.net/sevenzip/7z914-x64.msi

Wish I had a Win7 machine to check it out on.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
JM|Tomi
JM|Tomi's picture

Joined: 2004-10-11
Posts: 54
Posted: Tue, 2010-07-27 11:07

Hi guys,

If I click the Download Album on the root page of the gallery, it offers a file to download with name ".zip". I guess the root album does not have directory name or something. In this case the name of the gallery should be put into the filename. Or an ability to disable downloading the root album would be useful. What do you think?

Thanks,
JM|Tomi

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Tue, 2010-07-27 12:17
JM|Tomi wrote:
If I click the Download Album on the root page of the gallery, it offers a file to download with name ".zip". I guess the root album does not have directory name or something.

You're right. I found this bug few days ago. I fixed it but it is not yet commited because it needs some more testing. For now, I use a static name "Gallery" because if I use the gallery name, it must be cleaned of special chars.

 
deeegee

Joined: 2010-06-22
Posts: 6
Posted: Tue, 2010-08-31 14:23

Yes,
I have the 9.15 beta version and it's still not working. Perhaps there ist a way to change the unsuported chars so that windows can handle them.

 
hijacker

Joined: 2006-01-11
Posts: 7
Posted: Tue, 2010-09-14 07:14

Hi,
Recently I upgraded to G3 RC2 on Debian Lenny kernel 2.6.33.2-vs2.3.0.36.30.4nevir, php version: 5.2.6.dfsg.1-1+lenny9, apache2 version: 2.2.9-10+lenny8. I have enabled the downloadalbum plugin, however when I downloaded the zip archive via browser iceweasel version: 3.5.11-2 most of the files inside the archive had CRC errors. Example:

... bad CRC 275abf9b (should be 275abe9b)
... bad CRC 4676a9a6 (should be 4676a8a6)
... OK
... bad CRC a7222afd (should be a72229fd)
... bad CRC e4f9a0f9 (should be e4f99ff9)
... bad CRC 303836e0 (should be 303835e0)
... OK
... bad CRC 9856cf85 (should be 9856ce85)
... bad CRC 4ae61aab (should be 4ae619ab)
... OK
... OK
...

The difference only happens in the 3rd byte of the checksum.
So I tried various options to get the crc checksum properly added. And here is the patch:

48c48
< $f_crc32 = $this->fixBug45028(hexdec(hash_file('crc32b', $f, false)));
---
> $f_crc32 = crc32(file_get_contents($f));

Now all items are properly stored into my zipped archives of pictures. Hope this helps anyone else in my situation.

Cheers,
-Nik

 
carlstreeter

Joined: 2010-10-06
Posts: 29
Posted: Sun, 2010-10-10 05:16

Ondex,

I've extended downloadalbum to support downloading tag albums as well.

It works about as you'd expect. When viewing a URL of the type "tag/xxx", the floppy disk icon should show up. The zip file created has the tagged files in the server directory structure (but only as much of the directory structure as is needed, similar to the album zip files).

There shouldn't be any regressions relative to the album functionality, but if anyone notices anything let me know.

I think this makes this module much more useful. If you could integrate it into the released version, I think many people would appreciate it.

--Carl

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Wed, 2010-10-27 23:01

I committed a new version with your idea. Look the first post for the details.

I choosed another way to implement this functionality, but your patch helped me to start. Thanks.

I made some simple tests, it seems to work. Could you test it before I ask for the inclusion in the official repo ?

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Tue, 2010-11-02 21:56
hijacker wrote:
Hi,
Recently I upgraded to G3 RC2 on Debian Lenny kernel 2.6.33.2-vs2.3.0.36.30.4nevir, php version: 5.2.6.dfsg.1-1+lenny9, apache2 version: 2.2.9-10+lenny8. I have enabled the downloadalbum plugin, however when I downloaded the zip archive via browser iceweasel version: 3.5.11-2 most of the files inside the archive had CRC errors. Example:

... bad CRC 275abf9b (should be 275abe9b)
... bad CRC 4676a9a6 (should be 4676a8a6)
... OK
... bad CRC a7222afd (should be a72229fd)
... bad CRC e4f9a0f9 (should be e4f99ff9)
... bad CRC 303836e0 (should be 303835e0)
... OK
... bad CRC 9856cf85 (should be 9856ce85)
... bad CRC 4ae61aab (should be 4ae619ab)
... OK
... OK
...

The difference only happens in the 3rd byte of the checksum.
So I tried various options to get the crc checksum properly added. And here is the patch:

48c48
< $f_crc32 = $this->fixBug45028(hexdec(hash_file('crc32b', $f, false)));
---
> $f_crc32 = crc32(file_get_contents($f));

Now all items are properly stored into my zipped archives of pictures. Hope this helps anyone else in my situation.

Cheers,
-Nik

Hello Nik and Ondex

Thank you Ondex for the DownloadAlbum module. I got CRC errors as described by Nik. Both http and https. The Client used IE8 Windows XP, in this case. The server is listed below. I could repeat the problem every time.

Thank you Nik. Your patch helped me. I had the same problem, but your patch works for me. The problem is gone.

I applied the patch onto what I think is the latest DownloadAlbum source from Git. The problem was still there until applied tha patch from Nik. ($f is now $f_path).

Operating system: Darwin 8.11.0
Apache: Apache 2.2
PHP: 5.2.4
MySQL: 5.0.51b
Gallery 3 as per release.

Best regards,

Magnus Larsson

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Wed, 2010-11-03 08:56
K_Magnus_Larsson wrote:
I applied the patch onto what I think is the latest DownloadAlbum source from Git. The problem was still there until applied tha patch from Nik. ($f is now $f_path).

Yes, you are using the latest version ($f_path is from the recent commits)

K_Magnus_Larsson wrote:
Operating system: Darwin 8.11.0
Apache: Apache 2.2
PHP: 5.2.4
MySQL: 5.0.51b

OK, may be I misunderstood the informations from the PHP bugtracker ( http://bugs.php.net/bug.php?id=45028 ). I supposed the bug was affecting PHP <= 5.2.6, may be it only concerns PHP == 5.2.6.

I will investigate in this way.

EDIT: I'm wrong. hijack uses 5.2.6 on Debian 5 and he has the problem. The strange point is that I also use Debian 5 with PHP 5.2.6...

 
spamsuxx

Joined: 2007-09-22
Posts: 33
Posted: Mon, 2010-11-15 00:47

Nice work, but it does not play well with the greydragon theme.

Not sure if it the fault of this module of the theme.

See here:
http://gallery.olausson.de (Module is placed top right barely visible)

Cheers

--
http://olausson.de
http://gallery.olausson.de

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Mon, 2010-11-15 07:30
spamsuxx wrote:
Nice work, but it does not play well with the greydragon theme.

Not sure if it the fault of this module of the theme.

Default theme (wind) defines icon of 34x27 pixels. So, my module comes with an icon of this dimension.

Greydragon overrides the icons with dimension of 22x17 pixels. That's the problem.

You must ask the author of greydragon to include an icon for downloadalbum.

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Mon, 2010-11-15 22:32

@K_Magnus_Larsson, @hijacker :
This bug is really strange. Could you:
1/ create an album named "test"
2/ upload the attached picture "test.png" in it
3/ go inside album "test" and download the ZIP.

Then, attach your zip to this thread and describe your config (OS & PHP version).

I hope it will help me to solve that.

EDIT: Just to precise, please run this test on the last code from my repo (without any patch)

 
hijacker

Joined: 2006-01-11
Posts: 7
Posted: Tue, 2010-11-16 14:21

hi,
i will have to upgrade to the stable code, as I am still on the RC2 ...

will do as soon as i have some time on my hands and will upload the zipped archive for you.

Cheers,
-Nik

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Mon, 2010-11-22 20:53
Quote:
@K_Magnus_Larsson, @hijacker :
This bug is really strange. Could you:
1/ create an album named "test"
2/ upload the attached picture "test.png" in it
3/ go inside album "test" and download the ZIP.

Then, attach your zip to this thread and describe your config (OS & PHP version).

I hope it will help me to solve that.

EDIT: Just to precise, please run this test on the last code from my repo (without any patch)

Hello ondex

I have followed the instruction and the zip file is attached as requested.

I am using a new Gallery3 installation and the last code without any patch.

My observations:
The zip file has CRC errors. Winzip can not unpack the file.
Winzip says:
"..Extracting to "C:\Magnus Larsson\test\"
Use Path: yes Overlay Files: no
Extracting test_1.png
CRC check failed.."

OS:
uname -a
Darwin Magnus-iMac-G5.local 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct
10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh
powerpc

PHP (and the rest of Gallery config):
Host name: Magnus-iMac-G5.local
Operating system: Darwin 8.11.0
Apache: Apache 2.2.14
PHP: 5.2.4
MySQL: 5.0.51b
Server load: Unavailable
Graphics toolkit: imagemagick

Client:
Windows XP SP3 Home Edition
IE8
Https used

More observations:
Http or https did not matter. Same error as above.
IE8 or Firefox did not matter. Same error as above.
I have tried without winzip. Windows XP zip can not upack the file either.
I used winzip since I know how to get a logfile from it.

However if I do the same thing on the server (imac OSX 10.4 Tiger) using Safari or Firefox, then it works.

Best regards,

Magnus Larsson

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Mon, 2010-11-22 21:19

Hello again ondex,

I can unzip the test.zip output file directly using OSX 10.4.
So whatever goes wrong does not affect OSX 10.4 and the zip/unzip system installed on that computer.
(..and again, download directly using my imac works).

Best regards,

Magnus L

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Tue, 2010-11-23 18:35

@K_Magnus_Larsson

Thanks for this file. I now see more precisely the problem.

For the file "test.png", the correct CRC is 07eaa1e5.
The CRC is correctly generated by :
- the command-line utility "zip" on Linux or Mac OS X
- the Windows Archiver
- the module downloadalbum on my server.

Your server generates the CRC 07eaa0e5. Only 1 bit of difference !

To diagnose the bug, could you edit modules/downloadalbum/controllers/downloadalbum.php to change line 73
from:
$f_crc32 = $this->fixBug45028(hexdec(hash_file('crc32b', $f_path, false)));
to:
$f_crc32 = hexdec(hash_file('crc32b', $f_path, false));

And then, regenerate the ZIP and send it to me.

It will not solve the problem but it will help me to find if the problem is in PHP or in my function fixBug45028().

Thanks for your help.

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Tue, 2010-11-23 21:07

Hello ondex,

I have applied the patch and regenerated the zip file.

Please find the new zip file attached.

Best regards,

Magnus Larsson

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Tue, 2010-11-23 22:27

Thanks to K_Magnus_Larsson, this CRC bug should be fixed now.

The problem was concerning only the 32 bits systems : because sometimes the integer value of the CRC is higher than PHP_INT_MAX, operations on it fails. I updated the function that manipulates the CRC.

Please update your gallery3-contrib and let me know.

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Wed, 2010-11-24 22:41

Hello ondex,

Works for me.

Thank you

Best regards,

Magnus L

 
masloki

Joined: 2010-12-15
Posts: 1
Posted: Wed, 2010-12-15 05:20

When the server is win7/iis, the filenames in the archive have a collection of forward and backward slashes showing the full server path. My mac had no problem with the archive, but windows couldn't handle it. I tried plinking around in the str_replace code and received an error 500 for my efforts :-). Any pointers?

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Sat, 2010-12-18 14:15
 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Sun, 2010-12-19 19:51

Hello ondex,

The module works well. However, I am interested in some feedback regarding PHP limits in relation to the module downloadalbum.

I got corrupt zip files when downloading larger sets of albums (630 Mbytes zipped, in this case). The 630 Mbytes needed 2-4 minutes to download. I could fix this by increasing the resource limits in php.ini. I had fairly low (default?) limits of 30 seconds and 128 Mbytes memory for a script in my original php.ini.

Two obvious candidates are max_execution_time and memory_limit. I modified them as stated below, without too much analysis done.

Do you have a guideline how these parameters relate to the size of a download and time needed to execute a zip download?

"max download time for a user" < max_execution_time in php.ini ?
"size of zip" < memory_limit in php.ini ?
Other parameters?

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 1800 ; Maximum execution time of each script, in seconds (30)
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 1024M ; Maximum amount of memory a script may consume (128MB)

Best regards,

Magnus L

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Sun, 2010-12-26 13:24

@K_Magnus_Larsson :

I made a test on my server :
- memory_limit = 128M
- max_execution_time = 30

I downloaded a ZIP file of 3GB in 30 minutes. I did not get any corruptions.

The module uses the function readfile(), so it should not consume RAM (few MB maximum). max_exec_time should not be a problem too, because PHP does not spend time executing the code (it is always waiting for the data to be send through Internet).

I can't explain your problem. Do you see something in your HTTP server logs ?

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Sun, 2010-12-26 16:54

@K_Magnus_Larsson :

I did some more tests. With the configuration described above, I tried to download an album of 7.9G. It stopped between 4.5G and 5G.

Then, I increased max_execution_time to 120. I can now download the entire album (7.9G, ~75 minutes) without problems.

It seems that for big album, max_execution_time must be increased. I will maybe change this value in the controller of the module.

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Sun, 2010-12-26 18:41

Hello ondex,

Thank you for checking. Please find some more tests below.

When I use:
- memory_limit = 128M
- max_execution_time = 30

A 620 Mbytes download fails insofar that the zip file can not be read.

When I use:
- memory_limit = 128M (no change)
- max_execution_time = 60

The same download works and I can unzip the file.

It seems that for my server the 30s limit is below 600 Mbytes (iMac PPC G5 2.5 Gbyts RAM). This corresponds to my previous test result. The memory_limit parameter did not change anything, it seems. The 128M value is fine.

We gave a huge spread: 30s <--> 600 Mbytes and 30s <--> 4.5-5Gbytes.
What is the reason for this big spread? The performance of the server? Cpu? memory? other?

Best regards,

Magnus L

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Tue, 2010-12-28 22:25

@K_Magnus_Larsson :

I'm not a PHP expert, but I think the difference is in the CPU. Mine is an Intel Xeon E5410 (QuadCore 2.33Ghz).

I think that because my CPU is more powerful, PHP spends less time doing the calculation of CRC of each files included in the ZIP.

So, with a PPC G5, it is impossible to calculate CRC of 600MB of data in 30 seconds. With a Intel E5410, it is possible to calculate CRC of 4.5GB of data in 30 seconds.

I will maybe add a dynamic modification of max_execution_time in the module. I'm not sure because on Windows servers, max_execution_time must be the total download time [1]. 200 seconds per 1MB of data should be enough (not everybody have a DSL connection at home).

[1] http://fr.php.net/manual/en/function.set-time-limit.php :
This is not true on Windows where the measured time is real.

 
K_Magnus_Larsson

Joined: 2010-11-02
Posts: 12
Posted: Wed, 2010-12-29 07:46

Hello ondex,

Thank you for interesting feedback. The difference is probably not a bug :-), rather a function of intrinsic server characteristics.

Perhaps you can consider a configuration note added to your module page.
http://codex.gallery2.org/Gallery3:Modules:downloadalbum

The advantage of this approach is that it is simple and robust and entirely under user control. A dynamic modification will, in a way, become a module side effect. This could trigger other trouble reports. It will also add module complexity.

Best regards,

Magnus L

 
JM|Tomi
JM|Tomi's picture

Joined: 2004-10-11
Posts: 54
Posted: Wed, 2010-12-29 23:13

Hi ondex,

Is it possible somehow to restrict downloading of the full gallery? I mean I don't want the users to allow click on donaloadalbum icon on the gallery root page.

Thanks,
JM|Tomi

 
JM|Tomi
JM|Tomi's picture

Joined: 2004-10-11
Posts: 54
Posted: Fri, 2010-12-31 17:57

Hi again,

I found a bug: when I have password protected albums in an ablum I want to download, that password protected album is also zipped, but the user does not have rights to see that album.
This is the albumpassword module I use: http://codex.gallery2.org/Gallery3:Modules:albumpassword

Regards,
JM|Tomi

 
gavving

Joined: 2011-01-15
Posts: 4
Posted: Wed, 2011-02-16 23:53

I also would like to see some ability to enable album download on a per album basis. I'd like to offer the ability to download an album, but only if there are no other albums nested inside of it. That would be a relatively easy way to enable album downloads, but keep users from downloading the thousands of pictures and using bandwidth and system resources.

 
edisonnews

Joined: 2011-03-27
Posts: 2
Posted: Sun, 2011-03-27 18:53

thanks for your great work!

i didn't like users to be able to download more than one album at once. therefore i changed the behavior a tiny bit:
When a user klicks the download button in an album he receives a zip File with all pictures contained in that album. if there are no pictures like in my root folder he receives a zip file with a .txt files that tells him that there are no pictures to download.

i would like an option to tweak this in the admin panel and from a usability perspective it would be nice if the download icon didn't show up if there was nothing to download.

for anyone who likes to have the same behavior: here are my modifications to /modules/downloadalbum/controllers.php

in function getFilesList($container)

modify
$items = $container->viewable()->descendants(null, null, array(array("type", "<>", "album")));

to
$items = $container->viewable()
// only get pictures that belong to this album
->descendants(null, null, array(array("type", "<>", "album"), array("parent_id", "=", $container->id)));

if an album contains no pictures this leeds to an error message.
therefore comment this lines in the same function:
//if (count($files) === 0) {
// throw new Kohana_Exception('no zippable files in ['.$container->name.']');
//}

in the function zip($container_type, $id)
i added some lines to include a txt file when no pictures were selected:

$files = $this->getFilesList($container);
// instead of anyoing the user with an exception we just send him a friendly message.
if (count($files) === 0) {
$files['./nopictures.txt'] = '/var/www/gallery3/nopictures.txt';
}

I think this could be done in a much better way without an absolute file path but it works for me. Maybe somebody else could correct this?

 
blackhole86

Joined: 2010-08-06
Posts: 16
Posted: Sat, 2011-04-09 12:00

Can you make this module compliant with multiple connections? This would allow to use download manager like Download Accelerator to improve the download speed.

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Sun, 2011-04-24 15:15

There is a new version in my repo. Look at first post to see what's new.

@blackhole86 : I wont because it will add too much complexity for such a little gain. If the server (or its administrator) limits your download speed, there is a reason ;-)

 
James.OD

Joined: 2008-02-18
Posts: 11
Posted: Mon, 2011-05-02 09:36

I'm using this, but the download link shows on the "home" page. I understand that this may be a limitation, but if I could toggle that download link on/off just for the homepage, that would be great. Chances of ppl running into an error on the homepage would be far less. Thanks

 
ondex

Joined: 2009-04-30
Posts: 40
Posted: Mon, 2011-05-02 09:56

@James.OD: you just have to deny the "Download album" permission for the root album. Then, allow it on the first-level sub-albums.

 
James.OD

Joined: 2008-02-18
Posts: 11
Posted: Mon, 2011-05-02 10:45

Is setting the album to "view" only essentially how you deny the "Download album" permission? I have the root level album set to view only and I still see the icon. All other permissions are denied @ root. There are only two other albums in root. One that one group can see and download full album, and one that everybody can see, but not download the album. I see the icon in all cases.