Request: Intelligent Attached Image Uploader

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Suggested Hosts
Post Reply
dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Request: Intelligent Attached Image Uploader

Post by dtleahy » Wed Jul 19, 2017 2:19 am

With the trend toward monetization of formerly free image hosting sites (like photobucket), more and more forums will probably want to allow members to attach images, which means the users are uploading images onto your server. Many forum members are not computer graphics savvy - they are doing great if they can successfully upload any image at all, and they certainly have no idea about how to reduce the attached image's file size before uploading.

[Image files right out of the forum user's camera or smart phone are often huge files, like several megabytes, literally 10 times larger than they need to be for display on a monitor.]

This leaves forum admins with 2 choices for attachments:

1. In the ACP, set the limits to "0", allowing anything. Users attach megabyte+ sized files, and those are then stored on the server. The server space fills up fast when image files are literally ten times bigger than needed.

2. In the ACP, set reasonable limits, such as no image files larger than 400kb, and no image files larger than 1280 pixels wide. If your forum is full of people that would be willing to post pictures, if they can post the files straight out of their digital camera, but simply will not post pictures if they have to reduce pixel dimensions and overall file size, then you understand the problem. They can post those gigantic image files right out of their camera onto Faceboog, damn it! and they want the same ease of use for your forum. Facebooger, of course, has a built-in, automatic, magical function to reduce image files' sizes.

I want an image attachment uploader extension that:
  • examines a file being uploaded (for pixel dimensions and file size)
  • if the pixel dimensions exceed the ACP width and height maximum settings, the photo is automatically reduced until both width max and height max have been met
  • the reduced photo is then saved to the server with some small percentage of JPG compression
This extension would address the problem of massive wasted server space - wasted on saving gigantic copies of image files. As far as I can tell, no one here at the phpbb forum is working on an extension that will reduce the size of image files uploaded as attachments. The phpbb team as well as some 3rd party developers seem to have covered the formatting aspect of resizing images - for display. I really hope someone with the php development skill and knowledge of available graphics function libraries will write an extension to solve the "huge image files as attachments wasting server space" problem.

Thanks for your consideration.

User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier
Contact:

Re: Request: Intelligent Attached Image Uploader

Post by javiexin » Wed Jul 19, 2017 2:24 pm

+10 !!

User avatar
Ger
Registered User
Posts: 1148
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: Request: Intelligent Attached Image Uploader

Post by Ger » Wed Jul 19, 2017 3:03 pm

This seems like a great idea actually.
Checkout my extensions: Simple CMS, Feed post bot, Modbreak, Magic OGP links and Live topic update

Like my work? Buy me a coffee to keep it coming. :ugeek:

User avatar
canonknipser
Registered User
Posts: 1167
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Request: Intelligent Attached Image Uploader

Post by canonknipser » Wed Jul 19, 2017 3:18 pm

As DavidIQ statet otherwhere:
DavidIQ wrote:
Wed Jul 19, 2017 12:26 pm
... as they do get resized by plupload, to a certain extent, based on the image size settings for attachments..
it is already implemented using plupload. http://www.plupload.com/docs/v2/Image-R ... lient-Side

But the current version of plupload has a bad algorithm for resizing (you can read it on the link above "currently it is not suitable for generating high-quality images (see #707), because it is using a default algorithm (apparently a so called nearest neighbor interpolation) for resizing. ".
There also was an issue with a quality parameter set to a bad default: https://tracker.phpbb.com/browse/PHPBB3-14770, but this is fixed in the current 3.1.1 and 3.2.1-Releases.
So, all you need to do is set you image file size for attachments to a high value (12MB or something ..) and set image dimension to something like 1024x1024 (and maybe wait for one of the next plupload versions to have high quality resized images ...)
Greetings
Frank
phpbb.de support team member
English is not my native language
New arrival - Extensions and scripts for phpBB
no support via PM or mail

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Wed Jul 19, 2017 9:55 pm

I'm thinking of php image and image file functions, and GD (http://php.net/manual/en/ref.image.php)

In terms of resizing and retaining quality, I'm thinking of the imagecopyresampled function:
http://php.net/manual/en/function.image ... ampled.php

"imagecopyresampled() copies a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity."

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Wed Jul 19, 2017 10:19 pm

canonknipser wrote:
Wed Jul 19, 2017 3:18 pm
...it is already implemented using plupload. ...

But the current version of plupload has a bad algorithm for resizing (you can read it on the link above "currently it is not suitable for generating high-quality images (see #707), because it is using a default algorithm (apparently a so called nearest neighbor interpolation) for resizing. ".
There also was an issue with a quality parameter set to a bad default: https://tracker.phpbb.com/browse/PHPBB3-14770, but this is fixed in the current 3.1.1 and 3.2.1-Releases.
So, all you need to do is set you image file size for attachments to a high value (12MB or something ..) and set image dimension to something like 1024x1024 (and maybe wait for one of the next plupload versions to have high quality resized images ...)
It might be OK for something like creating small avatars, but unacceptable for most photos.

"...it is already implemented..."
This is part of the problem - people have been saying for a while now that phpbb code already handles the image file resizing problem. No, it doesn't. An algorithm resulting in poor quality reduced images is not a solution. Also, there are 2 steps in the solution:
1.) reduce the pixel dimensions of the image (resample and output)
2.) apply JPG compression (this drastically reduces file size in bytes)

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Fri Aug 25, 2017 5:19 pm

PLUpload released a new beta version, (v3.0-beta1), almost exactly one year ago! - and it has an improved algorithm for resizing images before upload. (See announcement here: http://www.plupload.com/punbb/viewtopic.php?id=14919)

I have written to the company (Ephox) that offers PLUpload, asking about a release date for 3.0, and hope that the phpbb developers will quickly implement the new version.

If anyone reading this is in agreement that decent quality image resizing/(reduction) - before uploading images - is an important functionality in phpbb, please add your voice so the phpbb development team sees our interest.

*** phpbb development team, please note that you can download the PLUpload 3.0-beta1 here: http://www.plupload.com/download/

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Sat Aug 26, 2017 9:12 pm

According to PLUpload support, they have already switched to a higher-quality image reduction algorithm:
from PLUpload support wrote:Some effort was put into Pluploads underlying core (mOxie) to improve image downsizing. In fact Plupload 2.3.1 (current stable version) does bilinear downsizing with gradient descent, which should give you much better result than nearest neighbor algorithm. Aren't you satisfied with results? What Plupload version are you currently using?

Plupload 3 is basically a restructure of version 2 - underlying core (that handles resizing) is the same for both. Restructure turned out to be a bit arguable so we left it there. However the last release (3.1.0) was in March this year. I'm working on a bugfix release for both branches. Plupload 2.3.2 is due on monday and 3.1.1 somewhat later the same week.
I guess the question for phpbb development team is, "What Plupload version [is phpbb 3.1 and 3.2] currently using?"

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Sun Aug 27, 2017 2:38 am

Is there any way that I can check myself, what version of Plupload is currently being used in phpbb 3.1.x and 3.2.x? Is it compiled into phpbb code, or is it a separate file and I could just copy the latest stable version of plupload to my forum's site?

If not, then where in the forum could I ask the same question of the dev team?

Thanks,

Dennis

User avatar
david63
Jr. Extension Validator
Posts: 13114
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Request: Intelligent Attached Image Uploader

Post by david63 » Sun Aug 27, 2017 6:33 am

dtleahy wrote:
Sun Aug 27, 2017 2:38 am
Is there any way that I can check myself, what version of Plupload is currently being used in phpbb 3.1.x and 3.2.x?
You will find it in /assets/plupload - 3.2.1 is using version 1.3.4
dtleahy wrote:
Sun Aug 27, 2017 2:38 am
is it a separate file and I could just copy the latest stable version of plupload to my forum's site?
You could try, but I have no idea of any possible consequences - make a backup first.

To bring this to the attention of the developers you should create a bug report (I know the name sounds wrong but it puts in the tracker), linking back to this topic.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Mon Aug 28, 2017 7:07 pm

david63 wrote:
Sun Aug 27, 2017 6:33 am
...

To bring this to the attention of the developers you should create a bug report (I know the name sounds wrong but it puts in the tracker), linking back to this topic.
Thanks, David. I created an issue (15340) and it's in the tracker now.

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Tue Aug 29, 2017 4:55 pm

PLUpload v.2.3.3 was released yesterday.

dtleahy
Registered User
Posts: 160
Joined: Sun Aug 24, 2008 5:47 pm

Re: Request: Intelligent Attached Image Uploader

Post by dtleahy » Wed Aug 30, 2017 4:00 pm

I edited the hard-coded "quality" value in plupload.php, changed it from 100% to 84% (16% JPEG compression.) This solved my issue as a board admin that wants to allow uploaded/ attached images, but doesn't want ridiculously large files saved to our server. The same 3MB image that results in a 1.5MB file (using 100% quality) is around 270KB when compressed at the 84% level - and the image (at 1280 x 900, our board's chosen size) still looks great. The testing I have done, using 84% quality value yielded image files from 11 to 16 times smaller than "quality=100%." That is pretty significant.

User avatar
Leinad4Mind
Translator
Posts: 804
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Request: Intelligent Attached Image Uploader

Post by Leinad4Mind » Sun Sep 10, 2017 7:08 pm

I've already an extension that does that basically. It used some algorithms as TinyPNG or Kraken to optimize the images when uploaded to the attachments of the forum, and another ext for automatically easely resize if the image is bigger then the max value and we can crop or not, as we wish.

Cheers
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator

amulheirn
Registered User
Posts: 20
Joined: Mon Nov 23, 2015 9:04 am

Re: Request: Intelligent Attached Image Uploader

Post by amulheirn » Wed Nov 22, 2017 7:35 pm

+10 for this request.

Facebook's ease of uploading images is (in my opinion) killing my forum's usage. Anything that makes image uploading/embedding easier will attract users back and is most welcome.

Looks like the plupload upgrade is scheduled to be in 3.2.2 when I look at the tracker.

Post Reply

Return to “Extension Requests”

Who is online

Users browsing this forum: No registered users and 15 guests

cron