#!/usr/bin/perl -w use CGI qw(:standard); my $image_generation_code_directory = "/research/mdewsnip/greenstone/image-generation"; my $images_directory = "/home/mdewsnip/public_html/greenstone/temp-images"; my $images_directory_url = "http://www.cs.waikato.ac.nz/~mdewsnip/greenstone/temp-images"; print "Content-Type: text/html; charset=utf-8\n\n"; print start_html("Greenstone collection image generation"); print "

Greenstone collection image generation

"; print hr(); # Language code and macrofile name my $language = param("l") || "en.english"; # Collection name (ASCII characters only) my $collection_name = param("collection"); $collection_name =~ tr/a-zA-Z0-9//cd; my $text_unicode = param("text"); if (defined $text_unicode && $text_unicode ne "") { my $language_code = (split(/\./, $language))[0]; my $language_modifier = ""; my $image_directory = ""; unless ($language_code eq "en") { $language_modifier = "[l=$language_code]"; $image_directory = "$language_code/"; } # Write a temporary macrofile containing the text for the images $text_unicode_raw = $text_unicode; # May contain "\n" to split the green_title text open(MACROFILE, ">$image_generation_code_directory/web-images.dm") || (print "Error: Could not open web-images.dm for writing.", end_html() && die); print MACROFILE "\#\# \"" . $text_unicode_raw . "\" \#\# collection_icon \#\# $collection_name \#\#\n\n"; close(MACROFILE); `cd ..; source setup.bash; cd $image_generation_code_directory; make-images.pl -language_symbol $language_code -image_dir $images_directory web-images.dm; rm web-images.*`; print "

Greenstone collection images with text \"" . $text_unicode_raw . "\":"; print "

"; print "

"; print "

\n"; print "These images should be put in the collect/$collection_name/images/$image_directory folder of your Greenstone installation.\n"; print "

\n"; print "To get Greenstone to use the new images, you need to specify them in your collection configuration. If you're using the GLI, open your collection, switch to the Design -> General view, and use the Browse buttons to select your images. The 'about page' image is $collection_name.gif, and the 'home page' image is ${collection_name}_sm.gif.\n"; print "

\n"; print "Alternatively, edit your collection's collect.cfg file manually and add:\n"; print "

\n"; print "\n"; print "collectionmeta iconcollectionsmall $language_modifier \"_httpprefix_/collect/$collection_name/images/$image_directory" . "${collection_name}_sm.gif\"\n
"; print "collectionmeta iconcollection $language_modifier \"_httpprefix_/collect/$collection_name/images/$image_directory" . "$collection_name.gif\"\n"; print "
\n"; } else { print "

Error: parameter not defined."; } print end_html();