OpenOffice and Powerpoint

Bill Campbell bill
Mon May 17 11:42:41 PDT 2004


On Sat, Jan 04, 2003 at 02:22:51PM -0500, Joel Hammer wrote:
>Hmmm....
>
>What I am going to have are four or five directories, each containing 4 or
>5 jpg images. The contents of each directory must be displayed in proper
>order, but the order of presentation at the directory level will be random.
>
>Since these presentations are at least a weekly event, what I am trying
>to do is work out a system where presentations can be generated with
>very little effort. I was wondering how I could generate Powerpoint
>presentations semi-automatically. That idea sounds dumb, when I write
>it down and look at it on paper.

Computers are best when they automate repetitive tasks.  One of
my primary gripes with M$ GUI programs like Word is that they
make many jobs more difficult.  I've been automating reports from
databases using perl scripts and groff for years.

>HTML might be better suited for this. It would be no sweat to create the html
>with sed and a little knowledge of html (That's describes my knowledge of
>html). Given the excellent results I have been getting with html2ps and
>ps2pdf, maybe the whole thing can be made into one big pdf file. In full
>screen mode, this might make a very nice presentation.  Now, that would
>give 'em something to talk about.
>
>It is interesting how many possibilities come to mind when you stop
>thinking in terms of MS software!
>
>This idea has merit. Got any more ideas?

I'm attaching a quicky script I wrote to create web pages with
thumbnails to catalog images in a directory.  This is crude, but
should give you some ideas.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Systems, Inc.
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Mechanical Engineers build weapons.  Civil Engineers build targets.''
-------------- next part --------------
#!/usr/local/bin/perl
eval ' exec /usr/local/bin/perl -S $0 "$@" '
	if $running_under_some_shell;
	shift if(join("", @ARGV) eq ""); # Xenix Kludge

# $Header: /u/usr/cvs/lbin/getopt.perl,v 1.14 2000/10/19 23:04:35 bill Exp $
# $Date: 2000/10/19 23:04:35 $
# @(#) $Id: getopt.perl,v 1.14 2000/10/19 23:04:35 bill Exp $

use File::Basename;
my ($progname, $dirname) = fileparse($0); # save this very early
chop($dirname);

do "/usr/bin/csspath.perl" unless $ENV{'USR_BIN_CSSPATH'};

$USAGE = "
#
#   Usage: $progname [-v] [-e var=value]
#
# Options   Argument    Description
#   -f      filename    File containing images to index
#   -c      integer     Number of columns (default 5)
#   -v                  Verbose
#
";

sub usage {
	die join("\n", at _) .
	"\n$USAGE\n";
}
# This is in the prototype because it's frequently fiddled on a
# case by case basis for local debugging.
sub run {
	my $cmd = shift;
	print STDERR "system($cmd)" if $verbose;
	system($cmd);
}
# do "getopts.pl";

use strict;

use Getopt::Long;
Getopt::Long::Configure qw {require_order bundling};

# declare global variables
use vars (
	'%opt_e',			# environment settings
	'$opt_h',			# print help
	'$opt_v',			# Verbose
	'$verbose',
	'$opt_c',
	'$opt_f',
);
usage("Invalid Option") unless GetOptions (
	'-e=s%',			# environment variables
	'-h|help',
	'-v|verbose',
	'-c|columns=n',
	'-f|file-list=s',
);
for (keys %opt_e) {
	$ENV{$_} = $opt_e{$_};
}
$verbose = '-v' if $opt_v;
my $suffix = $$ unless $opt_v;

sub un_taint {
	my $PATH = $ENV{'PATH'};
	$ENV{'PATH'} = $PATH;
	$> = $<;	# make it ignore taintedness (
	$) = $(;	# gids )
}
# &un_taint();	# make it ignore taintedness

# this sets TMPDIR to the largest available temporary directory.
require 'bigtmp.pl'; my $TMPDIR = &bigtmp();

$\ = "\n";	# use newlines as separators.

my $seq = 0;
my $fmt = qq(convert '%s' -geometry 80x60 %s);

$opt_c = 5 unless $opt_c;
open(INDEX, "> index.html");

print INDEX "<title>Index to @ARGV</title>";
print INDEX "<h1>Index to @ARGV</h1>";
print INDEX "<table col=$opt_c>";

open(INPUT, ($opt_f ? $opt_f : "gfind @ARGV -follow -type f | sort |"));
my @table_lines = ();

while(<INPUT>) {
	chomp;
	next if (/\.xvpics/);
	next unless(/\.(jpe{0,1}g|gif|tif{1,2}|png|xpm)$/i);
	$seq++;
	my $thumbnail = sprintf("image_%04d.jpg", $seq);
	my $cmd = sprintf($fmt, $_, $thumbnail);
	run($cmd) unless -f $thumbnail;
	push(@table_lines,
		qq(<td><A href="file:$_"><img src="$thumbnail"></a></td>));
}
while(@table_lines) {
	print INDEX join("\n\t", '<tr>',
		splice(@table_lines, 0, $opt_c),
		'</tr>');
}
print INDEX "</table>";

__END__
convert 01100076.jpg -geometry 160x120 /tmp/test.jpg


More information about the Linux-users mailing list