Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-07-07 00:26:21

woof
Member
Registered: 2004-08-01
Posts: 128

[request] Limit dimensions of uploaded images

I think it would be useful to have a plugin that allows you to set the maximum width or height in pixels that can be uploaded via the image upload form and displays a customisable error message in the case of oversize images. I’m finding that end users upload hires files straight from camera and dont develop the good habit of resizing images to more appropriate dimensions for use on web pages. Yes there are great plugins and techniques to crop and resize once the file is uploaded, but processing might be faster / simpler for them if the orignal picture was a more managable size to begin with. Is something along these lines possible?

Offline

#2 2009-07-07 07:34:22

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: [request] Limit dimensions of uploaded images

I think it cannot be done server-side (the file has to be previously uploaded) or with javascript (security reasons).

The solution may be to use a flash component that test the file dimensions.

Offline

#3 2009-07-08 00:39:14

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: [request] Limit dimensions of uploaded images

It can be done server side. The user would first have to upload the image, and if it failed the criteria, the plugin would delete it.

This might be a handy feature for the next version of EBL-Image-Edit

Offline

#4 2009-07-08 01:55:57

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: [request] Limit dimensions of uploaded images

woof wrote:

Yes there are great plugins and techniques to crop and resize once the file is uploaded, but processing might be faster / simpler for them if the orignal picture was a more managable size to begin with.

But then, you are not helping you user, giving a somewhat bad user experience, imho.
User has to upload the big file (that, being a big file, it may take some time) just to know that the image was rejected/deleted for not being in an appropriate size.

If user didn’t resized the image before uploading it, chances are that user doesn’t know how to do it, or doesn’t have the tools to do it (may be on a public computer), or expects to resize it once the image is already uploaded.

Thus, I believe the “workflow” doesn’t make too much sense, imho.

  1. User takes big picture.
  2. User save it on his/her computer
  3. User doesn’t seem to know how to edit large images “offline”, or doesn’t have the tools to do it (may be on a public computer) or expects to resize it once it’s already uploaded.
  4. User tries to upload big picture
  5. TXP/plugin rejects picture
  6. Back to 3: user doesn’t seem to know how to or can’t edit large images “offline”.
  7. User is pissed off.

A better solution, imho:

You may want to put some kind of note on the upload form, so user is told about required/maximum size for images before uploading.
Even, you can alert user with a javascript or modal alert.
Even further, you may alert user that once the image is uploaded, if dimensions are too large, image will be automagically resized to maximum dimensions (already configured somewhere on TXP Preferences or plugin Preferences) for images, that is XXXpx * YYYpx.
Or even further (and better?), you don’t resize the image automagically, but add an extra step where user is forced to resize/crop the large image to an image that fits, at most, on maximum allowed dimensions (but once the user is there, he/she may prefer to resize it or crop it to an even smaller size that the maximum allowed).

So, the workflow could be:

  1. User takes big picture.
  2. User save it on his/her computer
  3. User doesn’t seem to know how to edit large images “offline”, or doesn’t have the tools to do it (may be on a public computer) or expects to resize it once it’s already uploaded.
  4. User goes to upload form
    1. User is told/alerted that there is a maximum size for images and that s/he should resize it before uploading it, or
    2. User is told/alerted that there is a maximum size for images and that s/he will be able to uploaded but that he will have to resize it (or that is going to be resized automagically),
  5. User uploads big image and
    • big image is automagically resized to maximum dimensions, without asking user
    • user is presented with two options:
      • the option to let TXP resize the image to maximum allowed dimensions or,
      • the option to take an extra step that forces him to resize/crop the image to, at least, maximum allowed dimensions
  6. User is happy to have his picture on TXP.

Well, TheEric, master of images manipulation plug-ins is already here… there is nothing to be afraid of.

Last edited by maniqui (2009-07-08 02:11:30)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-07-08 02:00:40

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: [request] Limit dimensions of uploaded images

I’m with Julián. Well said my friend. :)

Offline

#6 2009-07-08 08:25:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: [request] Limit dimensions of uploaded images

maniqui wrote:

5. User uploads big image…

… assuming the PHP file size limit isn’t breached (2Mb by default? which is a bit small for a digital image these days). Even if it’s not, the time taken to upload the large file might be prohibitive given that most ISPs use assymetric dl/ul caps and can’t seem to grasp the effect that floods of ACK/NACK packets have on the user experience. Either way you still get:

7. User is pissed off

but for a different reason :-\


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2009-07-08 16:41:35

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: [request] Limit dimensions of uploaded images

Using flash, the system can grep the image-size prior to upload, and reject/deny preemptively before any bandwidth is used. This can also be done with Java as well.

Ideally though, in a perfect world, the user is informed of the image size restrictions prior to any attempted upload.

Offline

#8 2009-07-08 16:43:55

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [request] Limit dimensions of uploaded images

TheEric wrote:

Using flash, the system can grep the image-size prior to upload, and reject/deny preemptively before any bandwidth is used. This can also be done with Java as well.

Ideally though, in a perfect world, the user is informed of the image size restrictions prior to any attempted upload.

If using flash or java to check the size why not give the option to resize before uploading.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#9 2009-07-08 17:18:23

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: [request] Limit dimensions of uploaded images

MattD wrote:

If using flash or java to check the size why not give the option to resize before uploading.

I like that suggestion best, something like…

The selected image exceeds the recommended maximum dimensions. How would you like to proceed?

Upload and resize the image automatically (recommended)…     Upload the full-size image…

Offline

#10 2009-07-09 01:27:24

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: [request] Limit dimensions of uploaded images

MattD wrote:

If using flash or java to check the size why not give the option to resize before uploading.

Doesn’t work that way. Flash cannot resample the image, and Java is a bit clumsy with image handling. When Adobe AIR becomes a bit more it theoretically can do all the image handling/resizing prior to an upload, but we’re not exactly there yet.

Offline

Board footer

Powered by FluxBB