Announcement

#1 2016-03-23 09:15:49

torode
Member
Paris
2003-07-31
78

Video download when download button is clicked

Hello,

I uploaded videos in my gallery.
I installed and tried the VideoJS, Charlie's content and JPlayer plugins.
The video is displayed and plays correctly.
When I click on the download button/link the video is displayed in a new window/tab, instead of being downloaded (like zip downloaded).

I would like to force the download of the mp4 and mov formats (i.e. zip) instead of displaying them in the browsers.

I want to alter this behavior, which directions do you suggest?
Should I modify picture.php (if file extension=movie, then...) or write a plugin?

Thanking you in advance.

Piwigo version: 2.8
PHP version: 5.6.19
MySQL version: 5.5.44
Piwigo URL: http://

Last edited by torode (2016-03-23 10:12:21)


Seb

Offline

 

#2 2016-03-23 09:20:18

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: Video download when download button is clicked

Offline

 

#3 2016-03-23 10:38:55

torode
Member
Paris
2003-07-31
78

Re: Video download when download button is clicked

Merci pour l'info Pierrick !

From what I understand, the use of readLargeFile is to avoid a crash of php due to a very large file, does it also force the video file to be zipped instead of being displayed in a browser window?

Is there a work around considering the video extensions as picture or file extensions for the download workflow only?


Seb

Offline

 

#4 2016-03-27 22:14:16

torode
Member
Paris
2003-07-31
78

Re: Video download when download button is clicked

Hello!

I found a temporary hack.

First, create a tmp directory (/tmp).

Open picture.php, line 535, search for:

    { // not a pic - need download link
      $row['download_url'] = $row['element_url'] = get_element_url($row);;
    }

replace it with:

    { // not a pic - need download link
      $zip = $row['element_url'] = get_element_url($row);;
      $tmpzip = './tmp/'.uniqid(rand()).'.zip';
      exec("zip -j $tmpzip $zip");
      $row['download_url'] = $tmpzip;
    }


Seb

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact