[Gllug] Smart directories: Cron or fancier

Russell Howe rhowe at wiss.co.uk
Mon Sep 27 10:36:27 UTC 2004


On Mon, Sep 27, 2004 at 11:31:21AM +0100, Tom Schutzer-Weissmann wrote:
> Hello all
> 
> We'd like to create a shared directory that converts image files; the
> user saves, say, a JPEG, and it's immediately turned into PNG. I could
> use cron to check the directory every minute for new files, but
> wondered: is there a smarter or more instant way of checking for new
> files?

Cron is the simple way, and I'd at least implement that to begin with...

In Linux, there are two ways that I've heard about for receiving
notification of changes to the filesystem: dnotify and FAM. FAM may well
use dnotify and provide a higher level API, I don't know.. never used
either.

FAM is what Gnome's Nautilus uses to make filesystem changes be
automatically reflected in the views it offers. FAM is also the thing
which has on previous occasions had to be killed because it was holding
the CD mountpoint open at a time that I wanted to eject the CD.

I've heard that FAM is quite easy to program for, but I dunno - it's an
SGI thing which has been ported to Linux.

You could go totally nuts and use DMAPI or something which would let you
do really crazy stuff (stuff like providing virtual files, which are
generated on the fly - drop foo.jpg into a directory, and suddenly
foo.png appears alongside it, except the PNG is generated only when
accessed). I've also been told that DMAPI is ugly and evil though, and
it only works on XFS.

Another option would be to set up some kind of email service, whereby
people email JPEGs to pngmaker at foo.com and they get PNG versions of the
JPEG images in an attachment. You could even include processing
instructions in the email, specifying file format parameters, resizing,
etc...

Imagemagick is quite good for scripting these kinds of thing, but I
think the GIMP can also be scripted - there was a cgi-fu or something,
which allowed you to perform image operations from CGI scripts...

-- 
Russell Howe       | Why be just another cog in the machine,
rhowe at siksai.co.uk | when you can be the spanner in the works?
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list