Announcement

#1 2021-03-24 14:49:23

piwent
Member
2020-10-24
92

will .7z files uploaded cause a problem?

Greetings,

OK, please... I KNOW Piwigo is an image gallery. I know I really shouldn't be doing this. But...

I have added this to my local config:

Code:

$conf['file_ext'] = array_merge(
  $conf['picture_ext'],
  array('tiff', 'tif')
  );

(found here https://piwigo.org/forum/viewtopic.php? … 78#p162078)

And now I can upload .7z files to my gallery. I will then assign a custom thumbnail. (representative picture)

All of this works. Or at least appears to.

Am I going to break anything by doing this?

Offline

 

#2 2021-03-24 19:23:46

erAck
Only trying to help
2015-09-06
1415

Re: will .7z files uploaded cause a problem?

You followed a 5 years old post.. that array merge is already in the default config, though with more extensions, you just redefined it with less. It doesn't even include the .7z extension so you may have a later redefinition as well. Or you have [extension by jdd] Charlies' content installed. Anyhow, uploading non-picture files and having representatives for them does not break anything.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2021-03-25 01:58:17

piwent
Member
2020-10-24
92

Re: will .7z files uploaded cause a problem?

Thanks for the fast reply!

erAck wrote:

It doesn't even include the .7z extension so you may have a later redefinition as well.

I'm not sure I understand this correctly.

I do have Charlies' content plugin installed. When I go to upload now these are what is allowed:
jpg, jpeg, png, gif, tiff, tif, 7z, flv, mp4, swf, pls, m3u, wav, mid, au, aif, mp3, pdf, asf, wmv, divx, xvid, aiff, aac, bmp, gsm, mov, mpg, mpeg, m4a, psd, qt, qtif, qif, qti, snd, 3g2, 3pg, 3gp, zip, rar, gpx.

I guess my question is now, is there a better way to do what I did? This is everything in my local config

Code:

<?php

/* The file does not exist until some information is entered 
below. Once information is entered and saved, the file will be created. */

$conf['guest_access'] = false;
 
$conf['show_php_errors'] = E_ERROR;
$conf['format_ext'] = array('pef', 'cr2', 'tif', 'tiff', 'nef', 'dng', 'ai', 'psd');
$conf['upload_form_all_types'] = true;

$conf['enable_i_log'] = true;

$conf['file_ext'] = array_merge(
  $conf['picture_ext'],
  array('tiff', 'tif', "7z")
  );

?>

Placing 7z in this line

$conf['format_ext'] = array('pef', 'cr2', 'tif', 'tiff', 'nef', 'dng', 'ai', 'psd');

did nothing to make it work.

Thanks!

Offline

 

#4 2021-03-25 15:42:17

erAck
Only trying to help
2015-09-06
1415

Re: will .7z files uploaded cause a problem?

piwent wrote:

I do have Charlies' content plugin installed.

You didn't mention that.

Then a modification of file_ext or picture_ext shouldn't be necessary. Instead, add further extensions to your local config with $conf['Charlies more extensions'] like

Code:

$conf['Charlies more extensions'] = array('7z');

See plugins/charlies/charlies_config.php line 24 and following. (and yes, it should point that out in plugins/charlies/README-FIRST.txt so one doesn't have to inspect its source code).

Placing 7z in this line

$conf['format_ext'] = array('pef', 'cr2', 'tif', 'tiff', 'nef', 'dng', 'ai', 'psd');

did nothing to make it work.

You are misinterpreting what format_ext is for; images may be present in multiple formats, this is not related to what is allowed to be uploaded. Multiple formats are also only enabled if $conf['enable_formats'] = true; see include/config_default.inc.php


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2021-03-26 09:32:13

piwent
Member
2020-10-24
92

Re: will .7z files uploaded cause a problem?

erAck wrote:

You didn't mention that.

Very sorry. Since it didn't add 7z, and since the readme didn't talk about how to add more formats, I didn't think it mattered. Wrong I was!

erAck wrote:

Instead, add further extensions to your local config with $conf['Charlies more extensions'] like

Code:

$conf['Charlies more extensions'] = array('7z');

So I understood this to mean that I should remove the bit I added and replace it with the above. However when I do that I can no longer upload 7z. As it stands, here is my local config. Can't upload 7z:

Code:

<?php

/* The file does not exist until some information is entered 
below. Once information is entered and saved, the file will be created. */

$conf['guest_access'] = false;
 
$conf['show_php_errors'] = E_ERROR;
$conf['format_ext'] = array('pef', 'cr2', 'tif', 'tiff', 'nef', 'dng', 'ai', 'psd');
$conf['upload_form_all_types'] = true;

$conf['enable_i_log'] = true;

$conf['Charlies more extensions'] = array('7z');

?>

Can you tell what I'm doing wrong?

I really appreciate your help!

Offline

 

Board footer

Powered by FluxBB

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