Hey guys,
I developed a fix for bug http://sourceforge.net/apps/trac/gallery/ticket/1050 to replace swupload/uploadify by plupload.
Plupload is a multi-runtime uploader supporting HTML5/Flash/Silverlight etc. It has a number of interesting features among which the ability to resize JPEG/PNG on the client before sending.
This is a first version for code review. This was inspired by the default uploadify code and by the html_uploader module. So what does it do :
- replace the default uploader upon install
- re-use the same form to keep GUi consistency
- by default it uses the html5 runtime and should default to flash if it's not available (only tested on Linux with Iceweasel (Firefox) 18 and Chromium 25 so I couldn't test the fallback but the flash runtime is working fine.
- reduce the image before the upload to the "resize_size" parameters from Gallery. I will probably add a parameter in its admin page to set the max image size that can be uploaded instead of using this parameter
- once selected upload will start automatically
- multiple files upload is working
- reproduce the exact same GUI as the uploadify module. I wrote the jquery code from scratch instead of using plupload jquery GUI, but as this is my first ever jquery code (and javascript for that matter) I need your review/testing. It implement the queue with progress bar and the ability to cancel uploads individually or globally.
- chunking is currently disabled
What needs to be done :
- Add an admin page to put the max size for resizing on the client side. I am not sure what other parameters you would like on it. Maybe choose which runtime you want to enable ? Let me know.
- Put back the tags. This would require some change in the tag module as it add itself to the form. Unfortunately I didn't split the form like uploadify's as I didn't find a way to call the uploader from another form... If somebody has any idea.
- Enable chunking ?
- Error management is not done yet. For the moment it will be displayed in the debug output.
Please test it and report back to me. This is still a development version so be indulgent. I am a Java/C/C++ developer, Javascript/Jquery is new to me so there must be obvious mistakes.
Code is available on github : https://github.com/letic/gallery3-contrib/tree/master/3.0/modules/plupload
Zip is attached.
Public demo version : http://wps.letic.fr/Public-folder
Codex Page : http://codex.galleryproject.org/Gallery3:Modules:plupload
Cheers
LeTic
Edit : it seems that the tar.gz attachments is not working correctly added a zip instead.
Posts: 13
Here is an updated version with plupload 1.5.6
No change in the code yet I am waiting for feedback.
Did anybody test this with other browser on other OSs ?
Posts: 3
Hi,
Not working with Windows 7 (Explorer, chrome, Firefox tested). And not working on mi iPhone 4S, nor iPad (6.1.2) using Chrome or Safari.
The file seems to upload (in Windows), and when getting 100%, showed an error message. No files could be uploaded at all.
In iOS the uploading bar does not move and directly shows the error message.
The message was the same in both cases: Error: -200, Message: HTTP Error., File: image.jpg
Gallery 3.0.3 running on Linux 3.2.38, PHP 5.2.17, MySQL 5.5.23-55
Posts: 13
Hey Kiko,
Well I don't think the clients are to blame if you get the same behaviour in all browsers. It should at least work with Chrome and Firefox for sure.
You should check in your gallery var/logs/ folder first to see if there are any errors there, but most likely you will find the actual errors in the Apache logs.
Also have you checked the permissions on the module folders ?
The error you see looks like an error in the upload script itself when its called for the form submit.
Let me know if you see anything relevant in the logs.
LeTic
Posts: 3
Hi Letic, thank you for your advice and sorry for my delay answering.
I am not expert about Apache nor Php, but I am sure that permissions were right inside Gallery folders.
So, I tried a different way: new installation from zero in the same shared server (same Apache, Php, MySQL... versions), but in this case I installed a new Gallery 3.0.6 (the previous one was 3.0.3), and surprisingly Plupload could upload files from any browser or smartphone without error messages. Great! One could conclude that something at Gallery core was updated from 3.0.3 to 3.0.6... don't know what, but who minds.
Well, that problem solved.
May I talk about a new important one in this same reply? I suppose yes:
One gallery user has reported a mistake to me today. The size of many images (full size) were wrong, and it was detected when printing a picture (pixelated).
Plupload was the tool used to upload files (JPG), so I browsed the folders finding that the files in /var/albums had the same size than the ones in /var/resizes... I mean, a picture of 3.36Mb was finally only a hundred of kilobytes, the same in both folders.
I was the one who uploaded the file, so I am holding the original... I deleted the file at Gallery and re-uploaded it again using plupload, and got the same wrong size result at var/albums.
Then I deactivated plupload, retried and now the file got the right full size at var/albums.
Question: have you ever had this problem in the past? Possible incompatibility between Plupload and other modules?
Thank you.
Posts: 13
Hey Kiko-,
Nope it's not an issue it's the current expected behaviour ! The plupload module is not final yet it was just a testing version. The interest of using plupload (for me at least) was to resize the image on the client side before sending it to the server to save you the bandwidth. As I said in my original post :
The default value of the "resize_size" parameter is 640x480 in most themes. So this is what is happening. As I said the module was uploaded for code review and is not yet intended to be used on production server. If you want to use the plupload module without the resize comment line 74 in : plupload/views/form_plupload.html.php :
This will disable the resize on the client side.
I am currently working on the gallery3 debian packaging and have left this module aside for the moment. But if you are interested in a better version I will try to have a look at it soon.
Thanks a lot anyway for testing !
LeTic
Posts: 3
OK, I understand it nooooow (my mistake testing without reading first!!).
I need Plupload because it seems to be the only confortable way to upload files from iOS systems (we can also use 'html uploader' module, but uploading dozens of files at the same time is not possible).
And I do need to keep original full size of all the files, so I will comment the line 74 as you are recommending... THANK YOU.
I understand you are busy. No pressure... just to add, in the name of all iOS users (iPhone, iPad) of Gallery 3 web sites in the World ;) that we shall wait patiently a new admin parameter in this module to easily block such size reduction, from you or any other php expert enough.
It was a great work indeed, thank you again!
Posts: 5
Hello!
I found this module then my regular flash uploader start crashing. Any way flash uploader drop some files time to time - usually if I upload 5+ files at once. Plupload looks more stable - it didn't crash! (yet?) and also show prview in system-wide "open file" widget. But, it don't work on Opera linux 12.15 - then I click button to open files, after 5 sec it reload page. In Chrome linux 26 woks fine. I'll test at Monday from work from win7 IE10/FF/Opera/Chrome.
Few suggestions/feature requests:
create config option to disable resize-on-the-fly
create config option to disable debug message
Anyway - thank you very much for this module, now I can upload photos without manually re-check warnings about failed uploads.
Posts: 13
Hey evadim,
Thanks for the feedback ! Glad it can be useful !
Just concerning your suggestions :
yup this is planned, I actually started having a look at this code once more.
well as I said before this is still a WIP very early first working version. The debug output will obviously be disabled from more polished version.
Posts: 5
So, I'll wait for new versions to test
I think a bit about this 2 things, while upload few pics. Maybe better, combine config option with checkbox in upload dialog.
About HTML5/Flash - maybe you can place small icon somewhere to indicate is it flash or html, and end user know which dialog it actually in use...
Anyway, thanks for "very early first working version" of module - it work better for me, than stock one