Perl: Make XML for Image Import


Search rogansax.com


Coding Stories
Old printer meet windows 7
CSS and Printing
Bricolage on Linux
Hating the Gnome
Javascript
HTML
Installing Bricolage
Perl: Make XML for Image Import

Here is a simple perl script to convert jpegs to xml files for import into Bricolage. I haven't tested on Gifs or PNGs yet, but the script should work on them also.

Bulkimageimport.pl is meant to be run on a machine that has the Bricolage server installed. If you want to, you can remove the system command that calls bric_soap, and run this script on a seperate machine. You would then ftp the resulting XML files to a bricolage server, where the bric_soap command would be run to import the files.

The script requires the MIME::Base64 and Image::Info modules. They're available via CPAN. If you've got Bricolage up and running, installing a couple of Perl modules shouldn't be too difficult.

There are 6 variables you need to set before you can import your images. Category, inputdir, Server, Username, and Password.

This script was developed in order to allow for large batch imports of images into Bricolage. As such, it assumes that all the images are going into the same category. Enter the complete category path without leading or trailing slashes (roleplaying/miniatures).

Inputdir is the filepath to the directory that contains the images. Do not include a trailing slash.

Server is the url of your bricolage server. Use the url you use to log into Bricolage (http://yourserver:port).

Username and Password are the Bricolage User and Password that you would normally use. Be sure that your user has permissions to create images in Bricolage.

In case you want to do more with Imageinfo, I've included the following list of keys and values. Your values will of course differ depending on the images and application used to make them.