Integrating automatic image resizing

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
User avatar
canonknipser
Registered User
Posts: 69
Joined: Mon Sep 19, 2011 4:42 am
Location: Germany

Re: Integrating automatic image resizing

Post by canonknipser » Mon Aug 27, 2012 7:44 pm

keith10456 wrote:If you're viewing the post the image would already be resized - correct? So you wouldn't have to worry about your data cap.
Only if resizing is done on phpBB side, could be
  1. reading the image from the "foreign site" (50MB 5000*4000px),
  2. resizing [this can be done with gd or imagemagick] to maximum allowed resolution (eg. 50KB 500*400px),
  3. caching it and
  4. then send it to the Browser.
  5. For full resolution, the image can be clickable and then is read from the foreign site.
But creating the page can take a lot of time when there are a lot of big images, or foreign site has a bad response time ...

If there will be only a <img src="foreign/site/theimage.jpg" maxwith=500> or similar by html, css, javascript, clients browser has to read the image from the foreign site in full resolution and full filesize and then resizes it using html, css, javascript ...
Greetings
Frank
phpbb.de support team member - no support via PM or mail
English is not my native language
Extensions and scripts for phpBB

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

Re: Integrating automatic image resizing

Post by callumacrae » Mon Aug 27, 2012 8:13 pm

canonknipser wrote:Much simpler: on click open in new window - then Browser can decide (most often defaulted to "fit in windows" , after click magnify to 100%) - should be available in almost every modern browser.
On phpbb.de they use a function to change all [IMG]-Tags for external images to a [URL] with the link-text "externes Bild" (external Image).

So it is just a piece of comfort - the "resize" will be a image with the same number of bytes on clients side, only shrinked in width and height. If you put in a image of 50MB and 5000*4000 px and tell your function to resize it to 500*400 px, the image will still have 50MB send to end users browser. And my mobile "flat rate" with 500MB each month is gone after a few images of 500*400. :roll:

Isn't it better to block image of that size (check in posting function may be a way to do this, if we can read the images header on the remote side) and tell the poster to use a smaller version of the image or the attachment function with newly created automatic resizer?
What? How is that "simpler"?

Option one: Click to make bigger

Option two: Click to open in new window (invasive and disorientating). Click again to make bigger.

EDIT: Oh, you mean resize on the server-side. That could prove extremely expensive.
Made by developers, for developers!
My blog

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

Re: Integrating automatic image resizing

Post by DavidIQ » Mon Aug 27, 2012 10:15 pm

callumacrae wrote:Does it need a MOD? It's about six lines of JS xD
It sure isn't :-P

Edit: unless you're just saying to resize the images via an applied style property and just have a click event to open the full image up in the same or new window. Sounds pretty boring but sure. :P
Image

User avatar
Pony99CA
Registered User
Posts: 986
Joined: Sun Feb 08, 2009 2:35 am
Location: Hollister, CA
Contact:

Re: Integrating automatic image resizing

Post by Pony99CA » Mon Aug 27, 2012 10:51 pm

So would the IMG BBCode maximum image size limits in the ACP be changed from hard limits (giving an error when trying to post) to soft limits (forcing the image to display in the defined size, but allowing it to be viewed larger)?

The latter could lead to some mischief. Somebody could post a 10 GB image to a site and watch mobile users blow past their data plan limits. :twisted:

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.

User avatar
canonknipser
Registered User
Posts: 69
Joined: Mon Sep 19, 2011 4:42 am
Location: Germany

Re: Integrating automatic image resizing

Post by canonknipser » Tue Aug 28, 2012 4:49 am

At the moment, there is only a limit for the dimensions in ACP, not for the file size. It defaults to 0*0, which means no checking, and i think that most board owner will leave it this way.
But even if you change it to a value like 100*100, it simply can be "tricked", because it is only checked when the message is created or edited, not when it is displayed - just exchange the image on the remote site after checking from 100*100 to 10,000*10,000 ...
So, from me a yes for such a feature, but checking and eventually resizing must be done on server side just before displaying the message, maybe with a kind of caching - this will cost a lot of ressources.
Greetings
Frank
phpbb.de support team member - no support via PM or mail
English is not my native language
Extensions and scripts for phpBB

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

Re: Integrating automatic image resizing

Post by callumacrae » Tue Aug 28, 2012 10:31 am

DavidIQ wrote:
callumacrae wrote:Does it need a MOD? It's about six lines of JS xD
It sure isn't :-P

Edit: unless you're just saying to resize the images via an applied style property and just have a click event to open the full image up in the same or new window. Sounds pretty boring but sure. :P
8 lines of JS, two of which are boring: http://jsfiddle.net/UR8qm/

Obviously, a little "Click to enlarge" thing would have to be added when the image is small, but that could probably be done using CSS. This is how IPB (or at least, the IPB board I use) does it.

How is it boring? It allows the user to see both the small image and the big images without having to reload the page, and without have to rape the server xD
Made by developers, for developers!
My blog

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

Re: Integrating automatic image resizing

Post by DavidIQ » Tue Aug 28, 2012 10:46 am

Not really what most users would be expecting for this but sure! ;-)
Image

User avatar
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: Integrating automatic image resizing

Post by VSE » Tue Aug 28, 2012 5:43 pm

Just integrate ReIMG into the core and call it a day! It is, afterall, one of the most downloaded MODs for phpBB anyways. Maybe that is saying something about how much people like its functionality. It also, to get back on topic, is basically what OP was asking for.
Last edited by VSE on Tue Aug 28, 2012 5:44 pm, edited 1 time in total.
Has an irascible disposition.

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

Re: Integrating automatic image resizing

Post by callumacrae » Tue Aug 28, 2012 5:44 pm

DavidIQ wrote:Not really what most users would be expecting for this but sure! ;-)
The current behaviour is this:

Image
VSE+ wrote:Just integrate ReIMG into the core and call it a day! It is, afterall, one of the most downloaded MODs for phpBB anyways. Maybe that is saying something about how much people like its functionality. It also, to get back on topic, is basically what OP was asking for.
Having looked at the code, it would need a rewrite - no offence, David!
Made by developers, for developers!
My blog

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Integrating automatic image resizing

Post by MichaelC » Tue Aug 28, 2012 6:27 pm

VSE+ wrote:Just integrate ReIMG into the core and call it a day! It is, afterall, one of the most downloaded MODs for phpBB anyways. Maybe that is saying something about how much people like its functionality. It also, to get back on topic, is basically what OP was asking for.
+1
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

Post Reply