Bugzilla – Attachment 130307 Details for
Bug 28576
Add patron image in patron detail section does not specify image size limit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28576: Update the maximum size of an image.
Bug-28576-Update-the-maximum-size-of-an-image.patch (text/plain), 7.50 KB, created by
Martin Renvoize (ashimema)
on 2022-02-08 16:06:02 UTC
(
hide
)
Description:
Bug 28576: Update the maximum size of an image.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-02-08 16:06:02 UTC
Size:
7.50 KB
patch
obsolete
>From fd609bacf686d0b993394bbddca5d25ae671ee35 Mon Sep 17 00:00:00 2001 >From: The Minh Luong <the-minh.luong@inlibro.com> >Date: Tue, 1 Feb 2022 14:44:06 -0500 >Subject: [PATCH] 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> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt | 2 +- > .../intranet-tmpl/prog/en/modules/patroncards/image-manage.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt | 2 +- > patroncards/image-manage.pl | 2 +- > tools/picture-upload.pl | 2 +- > 6 files changed, 6 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc >index 768c83bbd4..b92449439d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patroncards-errors.inc >@@ -36,7 +36,7 @@ > [% ELSIF ( error == 301 ) %] > <span>An error has occurred while attempting to upload the image file. </span>[% INCLUDE asksysadmin %] > [% ELSIF ( error == 302 ) %] >- <span>Image exceeds 500KB. Please resize and import again. </span> >+ <span>Image exceeds 2MB. Please resize and import again. </span> > [% ELSIF ( error == 303 ) %] > <span>The database image quota currently only allows a maximum of [% image_limit | html %] images to be stored at any one time. Please delete one or more images to free up quota space. </span> > [% ELSIF ( error == 304 ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 202f54a401..20ac5769aa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -276,7 +276,7 @@ > [% ELSE %] > <div class="hint">[% patron.title | html %] [% patron.firstname | html %] [% patron.surname | html %] does not currently have an image available. To import an image for [% patron.title | html %] [% patron.firstname | html %] [% patron.surname | html %], enter the name of an image file to upload.</div> > [% END %] >- <p>Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 500KB.</p> >+ <p>Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB.</p> > <label for="uploadfile">Select the file to upload: </label> > <input type="file" id="uploadfile" name="uploadfile" required="required" /> > <div class="action"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >index d07300a7dc..5ccdfa89d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >@@ -39,7 +39,7 @@ > <p>Manage additional images to use as logo, decoration or background on a patron card layout.</p> > <form name="upload_images" method="post" action="/cgi-bin/koha/patroncards/image-manage.pl" enctype="multipart/form-data"> > <fieldset class="brief"> >- <div class="hint">Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 500KB.</div> >+ <div class="hint">Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB.</div> > <ol> > <li> > <label for="uploadfile">Select the file to upload: </label> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >index cad90f6c0a..d2d2d38d4c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >@@ -126,7 +126,7 @@ > [% END %] > <form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data" id="upload_form"> > <fieldset class="rows"> >- <p><strong>NOTE:</strong> Only PNG, GIF, JPEG, XPM formats are supported.</p> >+ <p><strong>NOTE:</strong> Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB.</p> > <ol class="radio"> > <li> > <label for="zipfile"><input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" /> Zip file</label></li> >diff --git a/patroncards/image-manage.pl b/patroncards/image-manage.pl >index 8c2d72456a..3a6365653c 100755 >--- a/patroncards/image-manage.pl >+++ b/patroncards/image-manage.pl >@@ -90,7 +90,7 @@ if ($op eq 'upload') { > else { > my $errstr = ''; > my $size = $image->Get('filesize'); >- $errstr = 302 if $size > 500000; >+ $errstr = 302 if $size > 2097152; > $image->Set(magick => 'png'); # convert all images to png as this is a lossless format which is important for resizing operations later on > my $err = put_image($image_name, $image->ImageToBlob()) || '0'; > $errstr = 101 if $err == 1; >diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl >index c708f7f244..57c55b9a12 100755 >--- a/tools/picture-upload.pl >+++ b/tools/picture-upload.pl >@@ -269,7 +269,7 @@ sub handle_file { > # Now process any imagefiles > $logger->debug("Source: $source"); > my $size = ( stat($source) )[7]; >- if ( $size > 550000 ) { >+ if ( $size > 2097152 ) { > # This check is necessary even with image resizing to avoid possible security/performance issues... > $filerrors{'OVRSIZ'} = 1; > push my @filerrors, \%filerrors; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28576
:
122048
|
122192
|
122423
|
122618
|
122759
|
130054
|
130088
|
130089
|
130306
| 130307