Permalink
Browse files

kohabug 2404 This patch removes Image::Magick and adds GD

This patch removes Image::Magick as a dependency and replaces it with
the (much) lighter GD. Functionality of patronimage code has not changed with
this conversion.

Adding errorhandling for corrupted image file and link to return to moremember.pl when called from there

Added notes about supported image mime types.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information...
Chris Nighswonger Joshua Ferraro
Chris Nighswonger authored and Joshua Ferraro committed Jul 28, 2008
1 parent 85832f8 commit 1baf6348cc38e4feeddad89332d78d08c81d5930
View
@@ -1783,7 +1783,7 @@ sub GetPatronImage {
my ($cardnumber) = @_;
warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug;
my $dbh = C4::Context->dbh;
- my $query = "SELECT mimetype, imagefile FROM patronimage WHERE cardnumber = ?;";
+ my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE cardnumber = ?';
my $sth = $dbh->prepare($query);
$sth->execute($cardnumber);
my $imagedata = $sth->fetchrow_hashref;
View
@@ -548,14 +548,14 @@ WriteMakefile(
'Date::Manip' => 5.44,
'Digest::MD5' => 2.36,
'File::Temp' => 0.16,
+ 'GD' => 2.34, #optional
'GD::Barcode::UPCE' => 1.1,
'Getopt::Long' => 2.35,
'Getopt::Std' => 1.05,
'HTML::Template::Pro' => 0.69,
'HTML::Scrubber' => 0.08,
'HTTP::Cookies' => 1.39,
'HTTP::Request::Common' => 1.26,
- 'Image::Magick' => 6.2, # optional
'LWP::Simple' => 1.41,
'LWP::UserAgent' => 2.033,
'Lingua::Stem' => 0.82,
View
@@ -78,14 +78,14 @@
Date::Manip
Digest::MD5
File::Temp
+GD
GD::Barcode::UPCE
Getopt::Long
Getopt::Std
HTML::Template::Pro
HTTP::Cookies
HTTP::Request::Common
HTML::Scrubber
-Image::Magick
LWP::Simple
LWP::UserAgent
Lingua::Stem
@@ -1,3 +1,3 @@
<!-- TMPL_INCLUDE NAME="help-top.inc" -->
-<h1>Member Information Screen</h1> <p>This screen shows the information associated with a given patron.</p> <p>On the top left is their address and card number.</p> <p>A patron's annual membership fee payment status also shows on this screen.</p><p>At the bottom of the patron information page you will find quick access to items the patron has checked out, overdue and on hold. </p><p>You can get information on what a patron has read in the past by clicking on the Circulation History button.</p> <p>If you would like to edit a patron's information, click the 'Edit' button.&nbsp; You can also click one of the 'Edit' links below each section on the patron record. </p> <p>If you would like to PERMANENTLY delete a user, click 'Delete' under 'More'. A confirmation box will appear, so don't worry about accidentally deleting a record. Just be absolutely sure before you delete!</p> <p>If no patron image exists for this patron, click the &quot;Add Patron Images&quot; link to add an image or images. The pixel dimensions should not exceed 120 X 200. </p>
+<h1>Member Information Screen</h1> <p>This screen shows the information associated with a given patron.</p> <p>On the top left is their address and card number.</p> <p>A patron's annual membership fee payment status also shows on this screen.</p><p>At the bottom of the patron information page you will find quick access to items the patron has checked out, overdue and on hold. </p><p>You can get information on what a patron has read in the past by clicking on the Circulation History button.</p> <p>If you would like to edit a patron's information, click the 'Edit' button.&nbsp; You can also click one of the 'Edit' links below each section on the patron record. </p> <p>If you would like to PERMANENTLY delete a user, click 'Delete' under 'More'. A confirmation box will appear, so don't worry about accidentally deleting a record. Just be absolutely sure before you delete!</p> <p>If no patron image exists for this patron, click the &quot;Add Patron Images&quot; link to add an image or images. The pixel dimensions should not exceed 120 X 200. Only PNG, GIF, JPEG, XPM formats are supported.</p>
<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
@@ -1,5 +1,5 @@
<!-- TMPL_INCLUDE NAME="help-top.inc" -->
<div class="main">
- <h1 id="hc1v"><font size="5" id="wi2o"><font size="4" id="gotr">Upload Patron Images</font></font></h1>This tool allows you to upload multiple patron images as a batch.<br /><br /><font id="hh140" color="#ff0000">IMPORTANT: Requires that the 'patronimages' system preference is set to 'ON' to use this feature.</font><br /><ul><li><em>Get there: </em>More &gt; Administration &gt; Global System Preferences &gt; Patrons &gt; patronimages</li></ul><br /><h2>Upload images in bulk</h2><ul><li>Go to the 'Tools' module (usually under 'More' in your Global Nav)</li><li>Choose 'Upload patron images' </li><li>You can choose to upload images in bulk by making a zip file with the images and a text file entitled &quot;DATALINK.TXT&quot; or &quot;IDLINK.TXT&quot;</li><li>For each group of pictures that has the cardnumber of the patron and the file containing that patrons picture. One patron per line separated by either commas or tabs. <br /><ul><li style="background-color: #ffffff"><font id="ux6f" color="#ff0000">IMPORTANT: Make sure that your TXT file is a plain text document, not RTF.</font></li><li><font id="sm7j" color="#ff0000"><span style="background-color: #ffffff">IMPORTANT: Make sure that you use either a comma or a tab to separate IDs from image names</span></font></li></ul></li><li>Add the images and the TXT file to a .ZIP file</li><li>Browse for the file from the Koha interface</li><li>Click 'Unpack' and you will receive a confirmation screen</li><li>To see the image(s) you imported search for the patron(s) and view their profile</li><li>If you'd like to change the image, just upload a new image</li><li>If you'd like to delete the patron image, click the 'Delete' button under 'Manage Patron Image'</li></ul><br /><font size="4" id="zr_8"><strong>Uploading Single Images</strong></font><br /><br />If you only have one patron image you might want to upload it via the patron information page instead of using this bulk tool.<br /><br /><ul><li>Go to the Patrons menu at the top of the staff client</li><li>Search for the patron you have the image for</li><li>If there is more than one result, click on the name of the patron you'd like to add an image to</li><li>Scroll down to the image upload form</li><li>Browse for the image on your computer and click 'Upload'</li><li>If you'd like to change the image, just upload a new image</li><li>If you'd like to delete the patron image, click the 'Delete' button under 'Manage Patron Image'</li></ul><strong><br /><br /><br />Why can't I upload patron images?</strong><br /><br />First you will need <span class="ex">a patronimages/</span> directory.&nbsp; If you do not have this directory you will see an error.<br /><div id="brc:" style="padding: 1em 0pt; text-align: left"><ul><li>Contact your system administrator to create this directory and you'll be set to go.</li></ul><br /><strong>What size should my images be?</strong><br /><br />There is a limit of 100K on the size of the picture uploaded and it is recommended that the image be 120x200 pixels, but smaller images will work as well.<br /></div><br />
+ <h1 id="hc1v"><font size="5" id="wi2o"><font size="4" id="gotr">Upload Patron Images</font></font></h1>This tool allows you to upload multiple patron images as a batch.<br /><br /><font id="hh140" color="#ff0000">IMPORTANT: Requires that the 'patronimages' system preference is set to 'ON' to use this feature.</font><br /><ul><li><em>Get there: </em>More &gt; Administration &gt; Global System Preferences &gt; Patrons &gt; patronimages</li></ul><br /><h2>Upload images in bulk</h2><ul><li>Go to the 'Tools' module (usually under 'More' in your Global Nav)</li><li>Choose 'Upload patron images' </li><li>You can choose to upload images in bulk by making a zip file with the images and a text file entitled &quot;DATALINK.TXT&quot; or &quot;IDLINK.TXT&quot;</li><li>For each group of pictures that has the cardnumber of the patron and the file containing that patrons picture. One patron per line separated by either commas or tabs. <br /><ul><li style="background-color: #ffffff"><font id="ux6f" color="#ff0000">IMPORTANT: Make sure that your TXT file is a plain text document, not RTF.</font></li><li><font id="sm7j" color="#ff0000"><span style="background-color: #ffffff">IMPORTANT: Make sure that you use either a comma or a tab to separate IDs from image names</span></font></li></ul></li><li>Add the images and the TXT file to a .ZIP file</li><li>Browse for the file from the Koha interface</li><li>Click 'Unpack' and you will receive a confirmation screen</li><li>To see the image(s) you imported search for the patron(s) and view their profile</li><li>If you'd like to change the image, just upload a new image</li><li>If you'd like to delete the patron image, click the 'Delete' button under 'Manage Patron Image'</li></ul><br /><font size="4" id="zr_8"><strong>Uploading Single Images</strong></font><br /><br />If you only have one patron image you might want to upload it via the patron information page instead of using this bulk tool.<br /><br /><ul><li>Go to the Patrons menu at the top of the staff client</li><li>Search for the patron you have the image for</li><li>If there is more than one result, click on the name of the patron you'd like to add an image to</li><li>Scroll down to the image upload form</li><li>Browse for the image on your computer and click 'Upload'</li><li>If you'd like to change the image, just upload a new image</li><li>If you'd like to delete the patron image, click the 'Delete' button under 'Manage Patron Image'</li></ul><strong><br /><br /><br />Why can't I upload patron images?</strong><br /><br />First you will need <span class="ex">a patronimages/</span> directory.&nbsp; If you do not have this directory you will see an error.<br /><div id="brc:" style="padding: 1em 0pt; text-align: left"><ul><li>Contact your system administrator to create this directory and you'll be set to go.</li></ul><br /><strong>What size should my images be?</strong><br /><br />There is a limit of 100K on the size of the picture uploaded and it is recommended that the image be 120x200 pixels, but smaller images will work as well.<br /><br /><strong>What image formats are supported?</strong><br /><br />Only PNG, GIF, JPEG, XPM formats are supported.i<br />
</div>
<!-- TMPL_INCLUDE NAME="help-bottom.inc" -->
@@ -203,11 +203,11 @@ if (nodename =="barcodes[]"){
<form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data">
<!-- TMPL_IF NAME="picture" -->
<fieldset class="brief"><legend>Manage Patron Image</legend>
- <div class="hint">To update the image for <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="surname" -->, enter the name of the new image file to upload and click 'Upload.' <br />Click the 'Delete' button to remove the current image.</div>
+ <div class="hint">To update the image for <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="surname" -->, enter the name of the new image file to upload and click 'Upload.' <br />Click the 'Delete' button to remove the current image. <br /> Only PNG, GIF, JPEG, XPM formats are supported.</div>
<!-- /TMPL_IF -->
<!-- TMPL_UNLESS NAME="picture" -->
<fieldset class="brief"><legend>Upload Patron Image</legend>
- <div class="hint"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> does not currently have an image available. To import an image for <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="surname" -->, enter the name of an image file to upload.</div>
+ <div class="hint"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> does not currently have an image available. To import an image for <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="surname" -->, enter the name of an image file to upload. <br /> Only PNG, JPEG, XPM formats are supported.</div>
<!-- /TMPL_UNLESS -->
<input type="hidden" id="image" name="filetype" value="image" />
<input type="hidden" id="cardnumber" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" />
@@ -27,27 +27,33 @@
<div class="yui-g">
<div class="yui-u first">
<!-- TMPL_IF name="ERRORS" -->
- <div class="dialog alert">
- <h3>Patron Image(s) Uploaded With Some Errors</h3>
+ <!-- TMPL_IF name = "TCOUNTS" -->
+ <div class="dialog alert">
+ <h3>Patron Image(s) Uploaded With Some Errors</h3>
+ <!-- TMPL_ELSE -->
+ <div class="dialog alert">
+ <h3>Patron Image Failed to Upload</h3>
+ <!-- /TMPL_IF -->
<!-- TMPL_ELSE -->
<div class="dialog message">
<h3>Patron Image(s) Successfully Uploaded</h3>
<!-- /TMPL_IF -->
<ul class="data">
<li>Unpacking completed</li>
- <li><!-- TMPL_VAR NAME ="TOTAL" --> directories scanned.</li>
- <li><!-- TMPL_VAR NAME="HANDLED" --> directories processed.</li>
+ <li><!-- TMPL_VAR NAME ="TOTAL" --> directorie(s) scanned.</li>
+ <li><!-- TMPL_VAR NAME="HANDLED" --> directorie(s) processed.</li>
</ul>
<!-- TMPL_LOOP name="COUNTS" -->
<ul class="data">
- <li><!-- TMPL_VAR name="TCOUNTS" --> image(s) moved into the database:</li>
+ <!-- TMPL_IF name = "TCOUNTS" --><li><!-- TMPL_VAR name="TCOUNTS" --> image(s) moved into the database:</li><!-- /TMPL_IF -->
<!-- TMPL_LOOP name="filenames" -->
<li><!-- TMPL_VAR name="source" --> - Cardnumber: <!-- TMPL_VAR name="cardnumber" -->
<!-- TMPL_IF NAME="filerrors" --><br /> <b>WARNING:</b> This image <i>not</i> imported because
<!-- TMPL_LOOP NAME="filerrors" -->
<!-- TMPL_IF NAME="DBERR" -->the database returned an error. Please refer to the error log for more details.</li>
<!-- TMPL_ELSIF NAME="IMGEXISTS" -->this patron does not exist in the database.</li>
<!-- TMPL_ELSIF NAME="MIMERR" -->the image format is unrecognized.</li>
+ <!-- TMPL_ELSIF NAME="CORERR" -->the image file is corrupted.</li>
<!-- TMPL_ELSIF NAME="OPNERR" -->Koha was unable to open the image for reading.</li>
<!-- TMPL_ELSIF NAME="OVRSIZ" -->the image file is too big.</li>
<!-- TMPL_ELSIF NAME="CRDFIL" -->the <!-- TMPL_VAR NAME="CRDFIL" --> is missing.</li>
@@ -60,8 +66,12 @@
<!-- /TMPL_LOOP -->
</div>
- <a id="uploadmore" href="/cgi-bin/koha/tools/picture-upload.pl">Upload More Images</a>
- <a id="doneupload" href="/cgi-bin/koha/tools/tools-home.pl">Return to Tools</a>
+ <!-- TMPL_IF name = "borrowernumber" -->
+ <a id="member" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR name = "borrowernumber" -->">Return to Patron Detail</a>
+ <!-- TMPL_ELSE -->
+ <a id="uploadmore" href="/cgi-bin/koha/tools/picture-upload.pl">Upload More Images</a>
+ <a id="doneupload" href="/cgi-bin/koha/tools/tools-home.pl">Return to Tools</a>
+ <!-- /TMPL_IF -->
</div>
<!-- TMPL_ELSE -->
<div class="yui-b">
@@ -78,12 +88,13 @@
<!-- TMPL_ELSIF name="OPNIMG" --><li><b>Cannot open <!-- TMPL_VAR NAME="OPNIMG" --> to read.<br />Please verify that it exists.</b></li>
<!-- TMPL_ELSIF name="DELERR" --><li><b>Unrecognized or missing field delimeter.<br />Please verify that you are using either a single quote or a tab.</b></li>
<!-- TMPL_ELSIF name="UZIPFAIL" --><li><b><!-- TMPL_VAR name="UZIPFAIL" --> failed to unpack.<br />Please verify the integrity of the zip file and retry.</b></li>
- <!-- TMPL_ELSE --><li><b>An unknown error has occurred.<br />Please review the error log for more details.</b></li><!-- /TMPL_IF -->
+ <!-- TMPL_ELSE --><li><b><!-- TMPL_VAR name ="CORERR" --> An unknown error has occurred.<br />Please review the error log for more details.</b></li><!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</div>
<!-- /TMPL_IF -->
<form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data">
<fieldset class="brief">
+ <div class="hint"><b>NOTE:</b> Only PNG, GIF, JPEG, XPM formats are supported.</div>
<ol class="radio">
<li class="radio">
<label for="zipfile"><input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" /> zip file</label></li>
Oops, something went wrong.

0 comments on commit 1baf634

Please sign in to comment.