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 by ]
Last edited by flop25 (2018-02-04 12:04:07)
Offline
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
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
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
Nice work!
Just wanted to point out that when selecting files, the red INFO line always shows zeros for me:
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:
I did that via this code in main.inc.php:
// 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 ...
Last edited by windracer (2018-02-17 00:03:45)
Offline
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
Offline
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
Offline
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
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
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
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
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
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
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
.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.
Offline
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