Converting DSL/DASL Pictures for INFOhio Library Automation

Eric Schumm, NOACSC, 11/13/2007  (edited by Charles Schmiesing, INFOhio, 11/19/2007. updated 7/7/2011)

This process uses two free utilities and a few script files to take a district directory of pictures in DSL/DASL and automatically convert them into a format suitable for use with INFOhio Library Automation.

The Setup

  1. Create a working directory for some of the items below.
  2. Select a computer to use for image processing. It will need to be running .NET Framework 2.0 and capable of connecting to the location of the pictures.
  3. Download and install Multiple Image Resizer.NET from http://www.multipleimageresizer.net. This program is free for personal and educational use.
  4. Download the 7-Zip command line version from http://www.7-zip.org/download.html and place it in the working directory you created in the first step.
  5. Create the directories c:\eraseme\pics to temporarily store some picture files. If you wish to use a different directory, do a find/replace for that directory in the INFOhioPics.cmd file and replace it with the directory of your choosing.
  6. In your working directory create the files listed below. You can create text file using your favorite text editor then paste in the contents for each file. The files you will need to create are: INFOhioPics.cmd, script.txt, images.txt, and Transferfiles.txt
  7. Configure the INFOhioPics.cmd file by changing the \\pictureserver\pics$ to the location containing your pictures.
  8. On the Solaris server hosting Symphony, create a directory and user that will be used when transferring the files to the server.
    a. Log onto the Solaris server as the "sirsi" user
    b. Acquire "root" privileges with the command "su root"
    c. Create a directory where the images will be transferred using a command similar to the following:  "mkdir /s/sirsi/DASL_Photos"
    d. Create a user that will be used when transferring files to the server. The example below creates a user called "photos":
    # useradd -c "FTP Account for DASL Photos" -d "/s/sirsi/DASL_Photos" -g "staff" -s "/bin/bash" photos
    # passwd photos
    e. Change the owner and protections of the directory created in step c to be the newly created user:
    # chown -R photos:staff /s/sirsi/DASL_Photos
    # chmod -R 775  /s/sirsi/DASL_Photos
    f. Use the "exit" command to log off of the Sun server
  9. Configure the Transferfiles.txt file by changing the itc.infohio.org to the INFOhio server where you will be doing your picture processing. Likewise, change the value username and password to the username/password values for the user account that will be used to place the picture files on that server.

The Running

  1. In your working directory (created in The Setup), create a new text file called RunIt.cmd
  2. Edit the file RunIt.cmd with a text editor (or right click on the file and pick Edit). Then type in the following two lines:

    call INFOhioPics.cmd ZZ
    pause

    Note: Replace the ZZ with the DSL/DASL district code you wish to process.

  3. Double-click on RunIt.cmd to process the pictures. You may be prompted for a username/password to connect to your picture directory.
  4. Repeat the process by editing the file and changing the ZZ to a different district or copy/paste the "INFOhioPics.cmd ZZ" line and make one line for each district you wish to run.

INFOhio Processing

  1. Log on to the server hosting the Symphony databases using the "sirsi" account.
  2. Review the contents of the directory created in step 8c. Example:
         OTST 1% ls -lh /s/sirsi/DASL_Photos/
  3. If necessary, rename the zip files to correspond to the instance codes used in Symphony.
  4. Run the OHdaslrenamephotofiles.sh script
  5. Alternatively, you can process the files individually:
    • Move the zip file to the corresponding XX/Unicorn/Custom/Photos/ directory (where XX is the instance code assigned to the district):
           OTST 2% mv /s/sirsi/DASL_Photos/ZZ.zip XX/Unicorn/Custom/Photos/
    • Unzip the file
           OTST 3% cd XX/Unicorn/Custom/Photos/
           OTST 4% unzip zz.zip
           OTST 5% cd
    • Proceed to step 4 (running OHrenamephotofiles.sh) of the "Loading Patron Photos For SirsiDynix Unicorn" section in the INFOhio Patron Update documentation.

INFOhioPics.cmd (Note:Location of mirdotnet.exe in step 2 might vary due to version, install location, etc.)

@ECHO OFF
REM
REM Create INFOhio pictures.
REM Created: 9/25/2007 Eric W Schumm

REM Start in the proper location (Replace X: with appropriate drive)
X:
cd \INFOhioPictureProcessing 

REM
REM Step 0 - Check for district parameter
REM
IF "%1" == "" GOTO NODISTRICT

REM
REM Step 1 - Mapping drives, check/clean up directories
REM
NET USE P: /DELETE
NET USE P: \\pictureserver\pics$\%1

if not exist P:\*.jpg echo no pictures for %1
if not exist P:\*.jpg goto NOPICTURES

del c:\eraseme\pics\*.jpg
if exist c:\eraseme\pics\*.jpg pause


REM
REM Step 2 - Run the Picture conversion program 
REM
"\Program Files\Multiple Image Resizer .NET 4.5.2\mirdotnet.exe" /scriptfile="script.txt" /imagelistfile="images.txt"


REM
REM Step 3 - Archive the pictures
REM
7za.exe a -tzip %1 c:\eraseme\pics\*.jpg


REM
REM Step 4 - FTP the pictures to INFOhio server
REM
ftp -i -s:TransferFiles.txt

REM
REM Step 5 - Remove the zip file
REM
del %1.zip


REM
REM Finished, go to end of the file
REM 
GOTO END


:NODISTRICT
echo.
echo.
echo. You must provide a district code in order to run this command file ...
echo.
echo.     %0 DistrictCode
echo.
GOTO END

:NOPICTURES
echo.
echo. No pictures found or invalid directory for %1.  No processing done.
echo.
GOTO END


:END

script.txt

' Resize picture width: 76 pixels, height: 100 pixels 
Resize 76, 100
' Crop x,y (0,12) to x,y (76,76) 
Crop 0, 12, 76, 76
' Save images as JPEG's at minimum 75% quality to "processed" sub folder under original image
SaveToFolderJpeg "c:\eraseme\pics", 75, False

images.txt

p:\

Transferfiles.txt

open itc.infohio.org
username
password
bin
cd /s/sirsi/DASL_Photos
mput *.zip
dir
bye


Last Updated on April 24, 2013

[../../../footer.html]