On Fri, 10 May 2002 10:52:31 +0100 (BST)
Mark Fowler <[EMAIL PROTECTED]> wrote:
> > The basic text support could be extended to allow for images to be
> > overlayed on the text (or placed under the text), or stretch images
> > similarly to how Enlightenment displays window manager themes.
> 
> Hmm, yes.  I have it so the image can be aligned in various ways. 
> It's not quite up to stretching it yet, but we shall see.

I'm not either, all my module supports currently is text.

> > Essentially, arguments are passed using the PATH_INFO HTTP header.
> > We want the browser to think this is an actual file, instead of a
> > dynamically generated image, so that the browser is more inclined to
> > cache the content. So, a typical query would be:
> > 
> >   http://localhost/genText/font=ArialBold;size=24;fgcolor=#ffffff;
> >   bgcolor=#000000;rotate=90;text=This+Is+The+Text
> 
> This is indeed a key concept.  More importantly I designed my schemes
> so that they could actually be saved to disk with that filename.  One 
> possible idea would be to place the image creation in an ErrorHandler 
> which returns the image and writes it to the correct location on disk.
>  Thus the next time the image is called the perl code is skipped all 
> together and the image is simply sucked off of the disk.  I think
> Randal did a column on something like this a while back.

Yes, like I say in my caching section, I sort the arguments and then MD5
them, and thats the name of the file on disk. So
/tmp/Imagecache/0/1/A/098FAD9 etc.

I actually do this process in the URI Transformation phase.  I intercept
a request, check to see if the given arguments already has a cache entry
on disk, and if so, I change $r->filename() to that location on disk. 
Otherwise, I generate it, and again point to that filename...I then let
Apache serve the file.

> > *) Configuration Files
> 
> I was thinking of using a system accessible in the httpd.conf for the 
> apache module.

I want to stay away from httpd.conf-based config files.  Although great
for most things, the configuration of different image styles can be very
site-specific, so I wouldn't want to have to reboot every time someone
makes a change.  In addition to this, I would like image styles to be
editable through my Content Management System; if it's based in the
httpd.conf (or even an .htaccess file), that means I'm giving a customer
access to the control of the webserver, and that makes the hair stand up
on the back of my neck.

Rather, I could define an XML configuration file, and use a directive in
the httpd.conf (or .htaccess) to point to the relevant configuration
file for that site/location.

> > *) Caching Schemes
> 
> I hadn't really considered caching systems.  Sounds good.
> 
> > Note: To prevent the filesystem from filling up, due to DoS attacks,
> > it may be prudent to have a cron job periodically cull files that
> > have the oldest access time.
> 
> Or have the handler do it itself after it's returned an image.  You'd
> also want the handler to keep a scoreboard of how many images have
> been generated in the last x minutes to stop generating for things
> like runaway spiders (though OTOH, this could probably be better
> handled by another module somewhere else in the chain)

I'm trying to keep from tying up the httpd processes unnecessarily.  I
just want to generate an image, and then pass it off to apache as fast
as possible.  If I have to disk scan (or even maintain a scoreboard in
memory), I'm not sure how that would affect performance.  It might not
be a bad idea to add a scoreboard, but I don't want it to have to do too
much.

> > Looking forward, I would like to be able to use this for more than
> > just text. I'd like my customers to be able to select an image, set
> > the maximum size, check a few boxes or radio buttons to say what
> > formatting options they'd like, and the image is automagically
> > resized without wasting disk space or taking a long time to
> > download.
> 
> Disk space cheap, CPU cycles expensive.

Disk space cheap, CPU cycles expensive, web developer time *really*
expensive.  So, auto-generate, and load from disk cache.

> > I'm sure there are plenty of other uses for this, but I'll leave it
> > at this.
> 
> I'm warey of creating a all too powerful module.  It's taken me an age
> to come up with an interface that I think (IMHO) that has a sensible
> user interface.  I wouldn't want to create something too powerful.

Unfortunately for me, I need to add these fancy-dancy features.  The
reason I'm coming back to this module of mine is because I need to have
background images behind text, semi-transparency of multi-layered
images, and resizing/scaling of images with borders and shadows, etc.

-- 

-man
Michael A Nachbaur

PGP Public Key at http://www.nachbaur.com/pgpkey.asc
PGP Key fingerprint = 83DC 7C3A 3084 6A21 9A3F  801E D974 AFB4 BFD7 2B6F

Reply via email to