File:  [LON-CAPA] / loncom / build / help_graphics_converter.pl
Revision 1.3: download - view: text, annotated - select for diffs
Fri Jul 19 16:56:23 2002 UTC (21 years, 11 months ago) by bowersj2
Branches: MAIN
CVS tags: version_0_5_1, version_0_5, HEAD
Make it go on perl 5.005

    1: # The LearningOnline Network
    2: # help_graphics_converter - converts help .png into .gif and .eps
    3: #
    4: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    5: #
    6: # LON-CAPA is free software; you can redistribute it and/or modify
    7: # it under the terms of the GNU General Public License as published by
    8: # the Free Software Foundation; either version 2 of the License, or
    9: # (at your option) any later version.
   10: #
   11: # LON-CAPA is distributed in the hope that it will be useful,
   12: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   13: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14: # GNU General Public License for more details.
   15: #
   16: # You should have received a copy of the GNU General Public License
   17: # along with LON-CAPA; if not, write to the Free Software
   18: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   19: #
   20: # /home/httpd/html/adm/gpl.txt
   21: #
   22: # http://www.lon-capa.org/
   23: #
   24: # YEAR=2002
   25: # 7/4, Jeremy Bowers
   26: #
   27: ###
   28: 
   29: use strict;
   30: 
   31: my $dirprefix = "../html/adm/help/";
   32: 
   33: # Check that the png directory exists
   34: if (not (-d $dirprefix . "png/"))
   35: { die "Can't convert help graphics because the png directory is not ".
   36:       "installed."; }
   37: 
   38: mkdir $dirprefix . "gif/", 0755;
   39: mkdir $dirprefix . "eps/", 0755;
   40: 
   41: foreach my $file (glob($dirprefix . "png/*.png"))
   42: {
   43:     my $filename = substr($file, rindex($file, "/") + 1);
   44:     my $gifdest = $dirprefix . "gif/" . substr($filename, 0, -4) . ".gif";
   45:     my $epsdest = $dirprefix . "eps/" . substr($filename, 0, -4) . ".eps";
   46:     
   47:     
   48:     print "Converting $filename... gif";
   49:     system ("convert $file $gifdest\n") if (not (-s $gifdest));
   50:     print " eps";
   51:     system ("convert $file $epsdest\n") if (not (-s $epsdest));
   52:     print " done.\n";
   53: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>