The /admin/user/settings page has an option for 'Maximum Picture Dimensions' and helpfully states that the measurement is in pixels.
Say a user requires a maximum image size of 100 x 100 pixels, what gets put in the box?
100
100x100
100*100
100,100
Not knowing what to use, the first thing a user might try is to guess at some reasonable input and have the system provide helpful feedback if the input is not vaild.
'foo' Is not a sensible dimension, yet when used in that field the module accepts it as perfectly valid.
Comment | File | Size | Author |
---|---|---|---|
#4 | validate_max_dimensions.patch | 1.55 KB | ksenzee |
Comments
Comment #1
ricabrantes CreditAttribution: ricabrantes commentedConfirmed.. moving to new version..
Comment #2
LAsan CreditAttribution: LAsan commentedVerified in 7.x-dev.
Comment #3
ksenzeeI'll take a stab at this...
Comment #4
ksenzeeThis patch adds a validator and some explanatory text for the maximum picture dimensions field. If you enter 'foo' or '80', it throws an error. '100x125' is accepted. A better approach might be to have two separate textfields, one for width and one for height, but this patch at least solves the immediate problem.
Comment #5
lilou CreditAttribution: lilou commentedYou patch look good, but i think it need a .test for user_picture_dimensions
Comment #6
lilou CreditAttribution: lilou commentedComment #7
dmitrig01 CreditAttribution: dmitrig01 commentedWorks for me, and looks good. Much needed. Not sure if it needs a test because that's basically testing php's explode().
Comment #8
lilou CreditAttribution: lilou commentedCross-post for title ;-)
Comment #9
Dries CreditAttribution: Dries commented1. It could use a test.
2.
It is not clear what this check is for. Wouldn't an empty dimension be a problem? The form description does not mention that it is a special case.
3. There are some minor code style glitches.
Comment #10
drewish CreditAttribution: drewish commentedi kind of think it'd be worth the trouble to add a dimensions form element. we could use it several places in core and i can think of a few contrib modules that could use it. would that be worth pursuing?
Comment #11
ksenzeeI agree it could use a test. I'll come up with one and address the other issues in #9. However, I also like the idea of adding a dimensions form element to core, and since I just figured out hook_elements 5 minutes ago (ahem) I could maybe whip one up. It would definitely be neater than the current patch. If I don't hear anything to the contrary I'll go ahead with that approach.
Comment #12
drewish CreditAttribution: drewish commentedksenzee, please do and post a link so i can follow up on that issue. i've been thinking more and more that it'd be handy to have.
Comment #13
Dave ReidAdding tags
Comment #14
mgiffordThis looks like it's related to this issue:
#590616: 0x0 Image Filesize Shouldn't Come With 0x0 Warnings
Comment #15
MichaelCole CreditAttribution: MichaelCole commentedWriting a test today.
Comment #16
MichaelCole CreditAttribution: MichaelCole commentedBug no longer relevant.
New UI has seperate fields for x and y.
New UI is at: http://www.d7c.dev/user/1/edit?destination=admin/people#overlay=admin/co...
Verify and close.