On Thu, Jan 23, 2003 at 08:03:01AM +0000, Matt Sergeant wrote: > Plugin > ------ > > The job here is two-fold. First, to decide if AxKit should process this > resource (and thus return OK), second, if it shouldn't process the > resource, and a jpeg should be created, then to create the jpeg, cache > it, set $r->filename() to the location of the cached jpeg, and then > return DECLINED. > > Provider > -------- > > If the plugin decides axkit needs to process this resource, you then > need to somehow turn the request for the jpeg into some XML. I believe > you've already got the code to do this, so I won't bore you with the > details. But basically you do this with a Provider, and set it with > AxContentProvider.
Tried that, and fallen at the first hurdle :-)
The top of the plugin looks like this:
package AxKit::App::Gallery::Plugin;
use strict;
use Apache::Constants qw(OK DECLINED);
use Imager; # Scaling
use Image::Info; # For width/height
# The job here is two-fold. First, to decide if AxKit should process this
# resource (and thus return OK), second, if it shouldn't process the
# resource, and a jpeg should be created, then to create the jpeg, cache
# it, set $r->filename() to the location of the cached jpeg, and then
# return DECLINED.
sub handler {
my $r = shift;
$r->log_error('In the plugin handler');
return DECLINED unless substr($r->content_type(), 0, 6) eq 'image/';
$r->log_error('Checking the size param');
# ... more code, which generates the cached image if necessary,
# and sets $cachedfile
$r->filename($cachedfile);
return OK;
}
1;
The entries in the log file from a freshly started Apache look like
this:
[AxKit] fast handler called for /pics/Boat/
[AxKit] Running plugin: Apache::AxKit::Plugin::QueryStringCache
[AxKit] Running plugin: AxKit::App::Gallery::Plugin
In the plugin handler
[AxKit] Plugin returned non-OK value
File does not exist: /home/nik/src/AxKit-Gallery/web/Boat/
The browser receives a 404 Not Found error. I've checked, that
directory does exist.
It looks like this should be possible, since the
Apache::AxKit::Plugin::Fragment module returns DECLINED at various
points, and I assume AxKit handles that OK.
This is with a version of AxKit checked out of CVS a few minutes ago.
Thoughts?
N
--
FreeBSD: The Power to Serve http://www.freebsd.org/ (__)
FreeBSD Documentation Project http://www.freebsd.org/docproj/ \\\'',)
\/ \ ^
--- 15B8 3FFC DDB4 34B0 AA5F 94B7 93A8 0764 2C37 E375 --- .\._/_)
msg02489/pgp00000.pgp
Description: PGP signature
