-## write coverpage
-
-# Generate the cover image. This can be done in two ways:
-# 1.- A file is available under the directory of JPEG files for the book
-# 2.- A file is generated using imagemagick
-
-# Cover filename
-my $coverImage = $outPath{'oebps'} . $FILENAME_SEPARATOR . "cover.jpg";
-# Cover filename generated by Project Aon
-my $pa_coverImage = $rulesHash{'language'} . $FILENAME_SEPARATOR . "jpeg" . $FILENAME_SEPARATOR .$rulesHash{'book-series'}. $FILENAME_SEPARATOR .$bookCode . $FILENAME_SEPARATOR . "cover.jpg";
-
-if ( -e "$pa_coverImage") {
- # Copy the file here
- print STDERR "DEBUG: Using cover from $pa_coverImage\n" if $verbose;
- system "cp $pa_coverImage $coverImage";
-} else {
-
-# Use Imagemagick if available
- if ( -x "/usr/bin/convert" ) {
-
- print STDERR "DEBUG: Will generate cover with ImageMagick\n" if $verbose;
- my $TITLE = quote_shell(find_title($bookXML));
- my $AUTHOR = quote_shell(find_author($bookXML));
- my $ILLUSTRATOR = quote_shell(find_illustrator($bookXML));
- my $convert_cmd = "";
-
- if ( -e "$fontFiles/SouvenirStd-Demi.otf" && -e "$fontFiles/SouvenirStd-Light.otf" ) {
- $convert_cmd="convert -size 600x800 -background white -font $fontFiles/SouvenirStd-Demi.otf -pointsize 32 -fill '#006633' -gravity north caption:\"\" -annotate +0+218 \"$TITLE\" -font $fontFiles/SouvenirStd-Light.otf -pointsize 22 -fill black -annotate +0+304 '$AUTHOR' -annotate +0+333 '$ILLUSTRATOR' $coverImage"
- } else {
- print STDERR "WARN: Fontfiles not found, using standard font\n";
- $convert_cmd="convert -size 600x800 -background white -pointsize 32 -fill '#006633' -gravity north caption:\"\" -annotate +0+218 \"$TITLE\" -pointsize 22 -fill black -annotate +0+304 '$AUTHOR' -annotate +0+333 '$ILLUSTRATOR' $coverImage";
- }
-
- print STDERR "DEBUG: Will run '$convert_cmd'\n" if $verbose;
- system $convert_cmd;
- }
-}
-
-# If there is no coverImage then we will change the XSL output
-my $addCover = "yes";
-$addCover = "no" if ! -e $coverImage;
-
-
-#
-# TODO: The coverpage seems to be stripped by Calibre since it
-# expects an image file for the coverpage. Alternatively, create
-# a jpeg file based on the HTML (using html2ps for example)
-# and use that for the OPF description of the book
-
-my $coverFileName = "coverpage.html";
-my $coverFile = "$outPath{'oebps'}$FILENAME_SEPARATOR$coverFileName";
-open( COVER, '>', $coverFile ) or
- die "$PROGRAM_NAME: unable to open OPF file for writing " .
- "\"$coverFile\"\n";
-
-my $cover = qx{$JAVA -classpath "$XALAN_JAR" org.apache.xalan.xslt.Process -IN "$bookXML" -XSL "$coverXSL" -PARAM opf-id "$uniqueID" -PARAM unique-identifier "$bookUniqueURI" -PARAM language "$rulesHash{'language'}" -PARAM book_series "$SERIES" -PARAM book_series_index "$SERIES_NUMBER" -PARAM addcover "$addCover"}; #" comment to unconfuse VIM syntax hilighting
-
-
-print COVER "$cover";
-
-close COVER;
-
-check_file($coverFileName);
-