Bug 28576

Summary: Add patron image in patron detail section does not specify image size limit
Product: Koha Reporter: Salman Ali <salman.ali>
Component: PatronsAssignee: Salman Ali <salman.ali>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: andrewfh, caroline.cyr-la-rose, david, eric.begin, fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, kyle, m.de.rooy, martin.renvoize, philippe.blouin, the-minh.luong, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This updates the add patron image screen to specify that the maximum image size is 2 MB. If it is larger, the patron image is not added.
Version(s) released in:
22.05.00,21.11.03,21.05.13
Attachments: Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Update the maximum size of an image.
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Update the maximum size of an image.
Bug 28576: Add patron image in patron detail section does not specify image size limit
Bug 28576: Update the maximum size of an image.

Description Salman Ali 2021-06-16 17:42:35 UTC

    
Comment 1 Salman Ali 2021-06-16 17:45:55 UTC
Created attachment 122048 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size
Comment 2 David Nind 2021-06-20 11:41:31 UTC
Created attachment 122192 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Marcel de Rooy 2021-06-25 09:41:18 UTC
tools/picture-upload.pl
        if ( $size > 550000 ) {

Hardcoded. Not so nice..
Comment 4 Marcel de Rooy 2021-06-25 09:44:53 UTC
Created attachment 122423 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2021-06-25 09:46:42 UTC
From: Salman Ali <salman@outaouais>

This is no valid email address
Comment 6 Jonathan Druart 2021-07-06 08:19:46 UTC
(In reply to Marcel de Rooy from comment #5)
> From: Salman Ali <salman@outaouais>
> 
> This is no valid email address

Salman, please fix.
Comment 7 Salman Ali 2021-07-06 13:02:52 UTC
Created attachment 122618 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Katrin Fischer 2021-07-10 09:08:39 UTC
Don't forget to reset the status when you have answered a QA/RM request :)
Comment 9 Katrin Fischer 2021-07-10 09:09:33 UTC
Hm, I realize it still has the wrong address, I am going to provide an updated patch.
Comment 10 Katrin Fischer 2021-07-10 09:12:04 UTC
Used:
git commit --amend --author "Salman Ali <salman.ali@inLibro.com>"
Comment 11 Katrin Fischer 2021-07-10 09:12:29 UTC
Created attachment 122759 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Jonathan Druart 2021-07-12 09:55:16 UTC
I will feel picky again, sorry in advance..

But.. Why "500KB" on the template when there is 550000 (bytes) hardcoded in the controller script?

And... Why 550000? That does not correspond to anything meaningful. Can we harmonise that please? Like 512KB?
Comment 13 Owen Leonard 2021-07-12 15:35:24 UTC
(In reply to Jonathan Druart from comment #12)

> And... Why 550000? That does not correspond to anything meaningful. Can we
> harmonise that please? Like 512KB?

If we're updating the file size limit I'd suggest 2MB at least. A photo from a smart phone these days is going to be between 1 and 2MB at least.
Comment 14 Eric Bégin 2021-09-08 19:49:33 UTC
IMO, we have 2 possibilities : 
syspref if we want librarian to be able to change it

or

koha-conf.xml : if this is something to be set by sysadmin.

Any preference ?
Comment 15 Jonathan Druart 2021-09-09 07:59:54 UTC
We are not asking for making it configurable, only to be meaningful and consistent.

I agree with Owen's suggestion, let use 2MB.
Comment 16 The Minh Luong 2022-02-01 20:11:55 UTC
Created attachment 130054 [details] [review]
Bug 28576: Update the maximum size of an image.

This patch modifies the maximum size of a patron's image, from 500KB to
2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a
patron, you can now see the supported file types AND the maximum size.

The following places are affected by this patch:
- Home/Patrons/anyPatron
- Home/Tools/Upload patron images
- Home/Tools/Patron card creator/Images

To test:
1)Search for any patron and go to his page.
2)Hover over the image area on the left and click on the "Add" button.
3)Notice that the message above the choose file button only specifies
file types without the maximum size.
4)Add an image bigger than 500KB.
5)Nothing happens. (This is because the maximum size is 5KB)
6)Apply the patch.
7)Repeat steps from 1 to 3.
8)Notice that the message now includes the maximum size.
9)Add an image bigger than 500KB, but smaller than 2MB.
10)The image is succesfully uploaded.
11)Add an image bigger than 2MB.
12)Nothing happens. (The maximum size is now 2MB)
13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and
"Home/Tools/Patron card creator/Images".
14)Notice that the maximum size is updated.
Comment 17 David Nind 2022-02-02 11:20:53 UTC
Created attachment 130088 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>
Comment 18 David Nind 2022-02-02 11:20:59 UTC
Created attachment 130089 [details] [review]
Bug 28576: Update the maximum size of an image.

This patch modifies the maximum size of a patron's image, from 500KB to
2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a
patron, you can now see the supported file types AND the maximum size.

The following places are affected by this patch:
- Home/Patrons/anyPatron
- Home/Tools/Upload patron images
- Home/Tools/Patron card creator/Images

To test:
1)Search for any patron and go to his page.
2)Hover over the image area on the left and click on the "Add" button.
3)Notice that the message above the choose file button only specifies
file types without the maximum size.
4)Add an image bigger than 500KB.
5)Nothing happens. (This is because the maximum size is 5KB)
6)Apply the patch.
7)Repeat steps from 1 to 3.
8)Notice that the message now includes the maximum size.
9)Add an image bigger than 500KB, but smaller than 2MB.
10)The image is succesfully uploaded.
11)Add an image bigger than 2MB.
12)Nothing happens. (The maximum size is now 2MB)
13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and
"Home/Tools/Patron card creator/Images".
14)Notice that the maximum size is updated.

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 Martin Renvoize 2022-02-08 16:05:57 UTC
Created attachment 130306 [details] [review]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 20 Martin Renvoize 2022-02-08 16:06:02 UTC
Created attachment 130307 [details] [review]
Bug 28576: Update the maximum size of an image.

This patch modifies the maximum size of a patron's image, from 500KB to
2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a
patron, you can now see the supported file types AND the maximum size.

The following places are affected by this patch:
- Home/Patrons/anyPatron
- Home/Tools/Upload patron images
- Home/Tools/Patron card creator/Images

To test:
1)Search for any patron and go to his page.
2)Hover over the image area on the left and click on the "Add" button.
3)Notice that the message above the choose file button only specifies
file types without the maximum size.
4)Add an image bigger than 500KB.
5)Nothing happens. (This is because the maximum size is 5KB)
6)Apply the patch.
7)Repeat steps from 1 to 3.
8)Notice that the message now includes the maximum size.
9)Add an image bigger than 500KB, but smaller than 2MB.
10)The image is succesfully uploaded.
11)Add an image bigger than 2MB.
12)Nothing happens. (The maximum size is now 2MB)
13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and
"Home/Tools/Patron card creator/Images".
14)Notice that the maximum size is updated.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 21 Martin Renvoize 2022-02-08 16:06:46 UTC
All works as described, new allowance hard coded.

Everything works here and QA script is happy.

Passing QA
Comment 22 Fridolin Somers 2022-02-15 06:37:13 UTC
No 4K selfies then ^^
Comment 23 Fridolin Somers 2022-02-15 07:42:25 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 24 Kyle M Hall 2022-02-18 11:41:59 UTC
Pushed to 21.11.x for 21.11.03
Comment 25 Andrew Fuerste-Henry 2022-03-04 15:00:00 UTC
Pushed to 21.05.x for 21.05.12
Comment 26 Victor Grousset/tuxayo 2022-03-18 00:14:14 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.