[RFC] Multiple file uploads

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
User avatar
Fyorl
Google Summer of Code Student
Posts: 27
Joined: Mon Apr 02, 2012 4:51 am
Location: UK
Contact:

Re: [RFC] Multiple file uploads

Post by Fyorl » Sun May 06, 2012 6:25 am

OK so I'm still really busy with Uni work but that won't interfere with the GSoC schedule. I also still haven't managed to find _hsr's branch either.

In any case, I plan to move ahead with implementing plupload's HTML5 code as a starting point. I don't think a consensus has been reached yet on whether to use HTML5 exclusively but it should be trivial to turn on the other upload methods available to plupload. I will place emphasis (in terms of testing and interface design) on the following features which I think are necessary to a good upload experience. The other features won't be explicitly disabled but only the ones that work 'out-of-the-box' will accessible.
  • Chunking
  • PNG resize
  • JPG resize
  • WEBP resize (not provided by plupload)
  • Stream upload
  • File size restriction
  • Upload progress
Obviously the above list can be modified at any stage if I get feedback or something crops up during development.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1731
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: [RFC] Multiple file uploads

Post by DavidIQ » Sun May 06, 2012 11:50 am

I believe that what has been stated has been if we have to fallback to a single upload due to there being no HTML5 support that it would be acceptable.
Image

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Multiple file uploads

Post by bantu » Sun May 06, 2012 3:31 pm

@Fyorl: You can assume it's either HTML5 or fallback to the current implementation for now.

User avatar
Fyorl
Google Summer of Code Student
Posts: 27
Joined: Mon Apr 02, 2012 4:51 am
Location: UK
Contact:

Re: [RFC] Multiple file uploads

Post by Fyorl » Sat Jun 09, 2012 3:17 pm

The feature branch for this is over here: https://github.com/Fyorl/phpbb3/tree/fe ... provements

Here is the current plupload configuration:

Code: Select all

$('#attach-panel .inner').pluploadQueue({
	runtimes: 'html5'
	, url: 'upload.php'
	, max_file_size: '10mb'
	, chunk_size: '1mb'
	, unique_names: true
	, filters: [
		{title: 'Images', extensions: 'jpg,gif,png,webp'}
		, {title: 'Archives', extensions: 'zip,rar,tar.gz,tar.bz2,7z'}
	]
	, resize: {width: 320, height: 240, quality: 90}
});
max_file_size can be pulled from the attachment settings section of the ACP. Do we need another option for chunk_size? I feel as though administrators will not want to configure this. The filters can be taken from the $cache->obtain_attachment_extensions() or just left blank since the server-side code will have to pass an extension check anyway. As for resizing, I guess that should be another option added to the control panel? Or if it's for the user's benefit then it should be possible to allow the user to select resize dimensions.

User avatar
brunoais
Registered User
Posts: 958
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC] Multiple file uploads

Post by brunoais » Sat Jun 09, 2012 3:38 pm

Fyorl wrote:

Code: Select all

$('#attach-panel .inner').pluploadQueue({
	runtimes: 'html5'
	, url: 'upload.php'
	, max_file_size: '10mb'
	, chunk_size: '1mb'
	, unique_names: true
	, filters: [
		{title: 'Images', extensions: 'jpg,gif,png,webp'}
		, {title: 'Archives', extensions: 'zip,rar,tar.gz,tar.bz2,7z'}
	]
	, resize: {width: 320, height: 240, quality: 90}
});
I prefer the "," on the right of the lines. Anyway, that's just a personal preference, I don't remember what's in the coding guidelines....
Last edited by brunoais on Sat Jun 09, 2012 6:54 pm, edited 1 time in total.

User avatar
Fyorl
Google Summer of Code Student
Posts: 27
Joined: Mon Apr 02, 2012 4:51 am
Location: UK
Contact:

Re: [RFC] Multiple file uploads

Post by Fyorl » Sat Jun 09, 2012 4:37 pm

I prefer them on the left because then it's easy to see if you've accidentally missed a comma. I didn't realise the coding guidelines covered JS but I'll change them to whatever is correct.

User avatar
callumacrae
Infrastructure Team
Infrastructure Team
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC] Multiple file uploads

Post by callumacrae » Sat Jun 09, 2012 5:39 pm

That's the job of your IDE ;-) commas should be on the right.
Made by developers, for developers!
My blog

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Multiple file uploads

Post by bantu » Sat Jun 09, 2012 10:40 pm

Fyorl wrote:

Code: Select all

$('#attach-panel .inner').pluploadQueue({
	runtimes: 'html5'
	, url: 'upload.php'
	, max_file_size: '10mb'
	, chunk_size: '1mb'
	, unique_names: true
	, filters: [
		{title: 'Images', extensions: 'jpg,gif,png,webp'}
		, {title: 'Archives', extensions: 'zip,rar,tar.gz,tar.bz2,7z'}
	]
	, resize: {width: 320, height: 240, quality: 90}
});
Commas on the right please. Also, ideally object properties and array items should always have a comma, but I think the JavaScript notation does not allow that for the last property/item.
Fyorl wrote:max_file_size can be pulled from the attachment settings section of the ACP.
Sounds good.
Fyorl wrote:Do we need another option for chunk_size?
Depends.

1. I think we have to ensure we specify plupload.chunk_size < php.post_max_size.
2. Is it better (i.e. faster or consumes less memory) to use a bigger chunk_size when post_max_size is higher and thus allows a higher chunk_size?
Fyorl wrote:The filters can be taken from the $cache->obtain_attachment_extensions() or just left blank since the server-side code will have to pass an extension check anyway.
The filters should be specified. It is quite annoying to upload big files just to then realise that the extension has been disabled.
Fyorl wrote:As for resizing, I guess that should be another option added to the control panel? Or if it's for the user's benefit then it should be possible to allow the user to select resize dimensions.
I don't think users need to be able to specify resize dimensions. I think images should just be resized to "Maximum image dimensions" (i.e. phpbb.img_max_width and phpbb.img_max_height). Those settings already exist. The thumbnail generation process can still be handled in PHP.

User avatar
drathbun
Registered User
Posts: 72
Joined: Wed Feb 15, 2006 6:40 pm
Location: Texas
Contact:

Re: [RFC] Multiple file uploads

Post by drathbun » Mon Jun 11, 2012 2:47 pm

Comma on the left allows one to comment out a line of code without rewriting it.
Sometimes you're the windshield, sometimes you're the bug.

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 557
Joined: Thu Sep 07, 2006 11:22 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] Multiple file uploads

Post by bantu » Mon Jun 11, 2012 3:08 pm

drathbun wrote:Comma on the left allows one to comment out a line of code without rewriting it.
In general this is not the case since you can not comment out the first line. The JavaScript notation supports spare comma on the left as much as it supports spare comma on the right: Not at all.

Furthermore, current coding guidelines apply and should be followed. If you think comma on the left is a useful change, please post in the coding guidelines topic instead.

Post Reply