Announcement

  •  » Extensions
  •  » [Plugin] Physical Browser Uploader

#1 2018-02-03 19:58:04

eliz82
Member
Romania
2016-04-27
235

[Plugin] Physical Browser Uploader

I have already stated more that 1 year ago that Piwigo should have an option of uploading images to physical folders using a web interface
http://piwigo.org/forum/viewtopic.php?p … 62#p164562

This weekend I have created a plugin for Piwigo that permits to upload images to existing physical albums using a HTML5 web browser form, instead of using a FTP client as default in Piwigo.

Tested with Piwigo 2.9.2 and Firefox 52. Make sure webserver process user have write permission to physical folders.

Download: extension:872


Uploaded Images

Last edited by flop25 (2018-02-04 12:04:07)

Offline

 

#2 2018-02-03 20:05:17

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

If anyone want to translate the french version interface or other languages please rename plugin.lang.php to plugin.lang.php.txt and attach it to a post here. thanks

@edit:
no idea how to deal with the physical directories permission yet. is hard for me to test because my Nginx webserver is run by root and because of that i never have problems with permissions :), I cannot properly make tests.
If anybody have errors with permissions please inform me.

Last edited by eliz82 (2018-02-03 21:53:25)

Offline

 

#3 2018-02-06 11:51:38

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

Published new version 2.9.d

Changelog:
- admin.php: check $_POST parameters prevent XSS attack if admin browser hijacked
- admin.php: check $_FILES extensions to be a picture on server side also
- admin.php: trying to prepare the folders for correct write permissions
- admin.php: replacing some plugin functions with some Piwigo ones from /admin/include/functions_upload.inc.php
- admin.php/admin.tpl: accepted file extensions are taken from the piwigo config
- admin.tpl: css fix figcaption word break for long file names

Offline

 

#4 2018-02-07 21:08:41

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

released version 2.9.e . changelog:
- admin.php/admin.tpl: added token to prevent CSRF attack
- admin.php/admin.tpl: added Quick local synchronisation link
- admin.php: removed filename length trim
- admin.php: spaces in filename will be removed as it's Piwigo default
- admin.tpl: css/javascript fix of image size flicker when preview images
- changelog.txt: fixed EOL to unix

Offline

 

#5 2018-02-16 23:52:59

windracer
Member
St. Pete, FL
2014-12-28
191

Re: [Plugin] Physical Browser Uploader

Nice work!

Just wanted to point out that when selecting files, the red INFO line always shows zeros for me:

http://piwigo.org/forum/showimage.php?pid=169882&filename=info-zero.jpg

It also looks like that area should show me thumbnails? I never see those like in your screenshot.

Also, when I was working on my version of the plugin (before you beat me to it, :-) ) I had added my UI to the Photos > Add area, instead of under the Plugins menu, thinking that made more sense. It looks like this:

http://piwigo.org/forum/showimage.php?pid=169882&filename=photo-add-upload.jpg

I did that via this code in main.inc.php:

Code:

// add ppu tab to the Add Photos tabset
add_event_handler('tabsheet_before_select','ppu_add_tab');

function ppu_add_tab($sheets, $id)
{
  if ($id == 'photos_add')
  {
    $sheets['ppu'] = array(
      'caption' => '<span class="icon-floppy"></span>'.l10n('UPLOAD_TAB'),
      'url' => get_root_url().'admin.php?page=plugin-physical_photo_upload',
      );
  }

  return $sheets;
}

In case you're interested in putting yours there. Not sure what the Piwigo developer guidelines say about adding tabs to the main areas like that ...


Uploaded Images

Last edited by windracer (2018-02-17 00:03:45)

Offline

 

#6 2018-02-17 00:11:52

flop25
Piwigo Team
2006-07-06
6791

Re: [Plugin] Physical Browser Uploader

I would say it's ok, but if you don't have a link under Plugin people get confused and don't know what the plugin does after enabling it, so you could add a link redirecting to your new page


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2018-02-17 00:15:31

flop25
Piwigo Team
2006-07-06
6791

Re: [Plugin] Physical Browser Uploader

I've seen that you are not using a SVN/Git: that would allow our translators to .. well translate it
ad it would allow you to have an issue tracking, changelog and direct contribution from anyone on github that you could validate in one click


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#8 2018-02-17 03:07:27

windracer
Member
St. Pete, FL
2014-12-28
191

Re: [Plugin] Physical Browser Uploader

flop25 wrote:

I would say it's ok, but if you don't a link under Plugin people get confused and don't know what the plugin does after enabling it, so could a link redirecting to your new page

Yeah I can see that, although it depends on the plugin. My Physical Photo Move plugin, for example, doesn't make sense to have under the Plugins menu, but as a new tab on the Photo (or Album) properties. But in this case (uploading a photo) I could see it being in both places.

Offline

 

#9 2018-02-19 06:48:41

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

windracer wrote:

Just wanted to point out that when selecting files, the red INFO line always shows zeros for me:
http://piwigo.org/forum/showimage.php?p … o-zero.jpg
It also looks like that area should show me thumbnails? I never see those like in your screenshot.

1) Strange, never had such an error on Firefox. What browser do you use, what OS, using some plugins that block scripts? Can you show me a print screen of browser JS console to see if some error appear. Sorry but i need your console to see what is happening, if I can't reproduce.

2) I prefer my plugin to have it's own option page.

Hope you will also make your plugin public as an alternative to my plugin.

Offline

 

#10 2018-02-19 14:03:39

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

Also what type of file extension did you chose? My JS only try to preview jpeg, png, gif. I use a Mozilla recommended method for previewing images https://developer.mozilla.org/en-US/doc … dAsDataURL in theory it should work on all modern browsers

Offline

 

#11 2018-02-19 14:47:56

windracer
Member
St. Pete, FL
2014-12-28
191

Re: [Plugin] Physical Browser Uploader

You're right, it works in Firefox, but not in Chrome, Edge, or Internet Explorer (for me). I was just testing with .JPG files. I'm not using any script blockers in Chrome and tried poking around in the Javascript console but didn't see any problems. I'll keep poking at it ...

Offline

 

#12 2018-02-19 17:13:35

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

Just tested with Chrome 56 and indeed preview is not working, I must say this is a surprise as in Mozilla docs say it should work with Chrome 7+ .
Also i don't see any error in Chrome console ... this is strange.

Offline

 

#13 2018-02-19 19:01:14

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

The Mozilla code was working fine for Chrome. I found 2 very weird bugs in my extra JS code. Such weird that they didn't show any errors in Firefox or Chrome console. Is not easy to debug blindly.

First bug it was getting properties from DOM elements and not refreshing them on events change if you execute functions that use those properties. This is clearly a bug. I don't really understand why everything worked perfect in Firefox as getElementById is not live https://stackoverflow.com/questions/191 … om-element

Second bug was a typo mistake, an extra space to a variable before equal, I found very weird as made my javascript to not work anymore in Chrome and Chrome console didn't show any error ... damn.

Last edited by eliz82 (2018-02-19 19:16:41)

Offline

 

#14 2018-02-19 19:42:42

eliz82
Member
Romania
2016-04-27
235

Re: [Plugin] Physical Browser Uploader

by the way Flop25 found a css problem when testing IE11 with my plugin. in IE11 there is some problems with alignments when showing multiple <li> infos. the square dots appear over the icon.


i added something like this to see if it fix

Code:

.infos li, .errors li, .warnings li, .messages li {
    margin-left: 40px;
}

it is working fine on IE, but i didn't tested how this affect rest of browsers.


Uploaded Images

Offline

 

#15 2018-02-19 19:50:34

windracer
Member
St. Pete, FL
2014-12-28
191

Re: [Plugin] Physical Browser Uploader

2.9.f is now broken. The image previews and info work in Chrome, but upload does not:

"Upload form is incomplete, please select an album and an image file"

I've tried selecting the album first, then images, and vice versa, same error. Also tried IE, same problem.

Offline

 
  •  » Extensions
  •  » [Plugin] Physical Browser Uploader

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2018 · Contact