f41b98 | 2009-05-07 | Martin Stjernholm | |
|
2e0a35 | 1999-12-09 | Martin Nilsson | |
|
37bdda | 1999-05-18 | Per Hedbor | | #include <module.h>
inherit "module";
|
3b85e9 | 1999-11-15 | Per Hedbor | | constant thread_safe=1;
|
37bdda | 1999-05-18 | Per Hedbor | |
roxen.ImageCache the_cache;
|
0917d3 | 2013-03-04 | Anders Johansson | | constant cvs_version = "$Id$";
|
b3281f | 2000-09-10 | Martin Nilsson | | constant module_type = MODULE_TAG;
|
bc0fa0 | 2001-03-08 | Per Hedbor | | constant module_name = "Graphics: Image converter";
|
739058 | 2000-06-01 | Martin Nilsson | | constant module_doc = "Provides the tag <tt><cimg></tt> that can be used "
"to convert images between different image formats.";
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
4b3fc0 | 2001-03-12 | Johan Sundström | | mapping tagdocumentation()
{
|
739058 | 2000-06-01 | Martin Nilsson | | Stdio.File file=Stdio.File();
if(!file->open(__FILE__,"r")) return 0;
|
b99658 | 2004-06-21 | Martin Stjernholm | | mapping doc = compile_string("#define manual\n"+file->read(), __FILE__)->tagdoc;
|
4b3fc0 | 2001-03-12 | Johan Sundström | | foreach(({ "cimg", "cimg-url" }), string tag)
doc[tag] += the_cache->documentation(tag +
" src='/internal-roxen-testimage'");
|
739058 | 2000-06-01 | Martin Nilsson | | return doc;
}
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
739058 | 2000-06-01 | Martin Nilsson | | #ifdef manual
|
9b0365 | 2001-03-07 | Kenneth Johansson | | constant tagdoc=(["cimg":#"<desc tag='tag'><p><short>
Manipulates and converts images between different image
formats.</short> Provides the tag <tag>cimg</tag> that makes it is
possible to convert, resize, crop and in other ways transform
|
720972 | 2012-05-09 | Jenny Dalenius | | images. It is possible to pass attributes, such as the alt attribute,
to the resulting tag by including them in the cimg tag. </p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | </desc>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
4b3fc0 | 2001-03-12 | Johan Sundström | | <attr name='src' value='url' required='required'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | The path to the indata file.</p>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
4b3fc0 | 2001-03-12 | Johan Sundström | | <ex><cimg src='/internal-roxen-testimage'/></ex>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | | </attr>
|
e44906 | 2008-10-29 | Erik Dahl | | <attr name='filename' value='string'><p>
Append the filename value to the path. Recommended is not to append file suffix
to the filename since there are settings for handling that automatically through
this module settings.
|
97bb93 | 2009-12-08 | Jonas Wallden | | </p><p>This is useful if you want to have images indexed, since many search engines
|
e44906 | 2008-10-29 | Erik Dahl | | uses the filename as a description of the image.</p>
<ex><cimg-url src='/internal-roxen-testimage' filename='Roxen Test Image'/></ex>
</attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='data' value='imagedata'><p>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | | Insert images from other sources, e.g. databases through entities or
|
9b0365 | 2001-03-07 | Kenneth Johansson | | variables.</p>
|
cba1fa | 2001-08-30 | Johan Sundström | | <ex-box><emit source='sql' query='select imagedata from images where id=37'>
|
79f3f1 | 2003-09-08 | Anders Johansson | | <cimg data='&sql.imagedata:none;'/>
|
cba1fa | 2001-08-30 | Johan Sundström | | </emit></ex-box>
|
ce011f | 2003-09-19 | Jonas Wallden | | </attr>
<attr name='process-all-layers'><p>Set this flag to make all image layers
visible regardless of their original state.</p>
</attr>
<attr name='include-layers' value='layer-glob-list'><p>Comma-separated list
of glob expressions which is matched against layer names. All matching
layers are made visible regardless of their original state.</p>
</attr>
<attr name='exclude-layers' value='layer-glob-list'><p>Comma-separated list
of glob expressions which is matched against layer names. All matching
layers are hidden regardless of their original state.</p>
|
922ef6 | 2005-10-06 | Anders Johansson | | </attr>
<attr name='exclude-invisible-layers'><p>Set this flag to
automatically exclude layers that are not shown in the original
image. This is only useful in combination with the
'process-all-layers' attribute.</p>
</attr>
|
5adc58 | 2009-11-30 | Henrik Grubbström (Grubba) | |
<h1>Timeout</h1>
<p>The generated image will by default never expire, but
in some circumstances it may be pertinent to limit the
time the image and its associated data is kept. Its
possible to set an (advisory) timeout on the image data
using the following attributes.</p>
<attr name='unix-time' value='number'><p>
Set the base expiry time to this absolute time.</p><p>
If left out, the other attributes are relative to current time.</p>
</attr>
<attr name='years' value='number'><p>
Add this number of years to the time this entry is valid.</p>
</attr>
<attr name='months' value='number'><p>
Add this number of months to the time this entry is valid.</p>
</attr>
<attr name='weeks' value='number'><p>
Add this number of weeks to the time this entry is valid.</p>
</attr>
<attr name='days' value='number'><p>
Add this number of days to the time this entry is valid.</p>
</attr>
<attr name='hours' value='number'><p>
Add this number of hours to the time this entry is valid.</p>
</attr>
<attr name='beats' value='number'><p>
Add this number of beats to the time this entry is valid.</p>
</attr>
<attr name='minutes' value='number'><p>
Add this number of minutes to the time this entry is valid.</p>
</attr>
<attr name='seconds' value='number'><p>
Add this number of seconds to the time this entry is valid.</p>
</attr>
|
922ef6 | 2005-10-06 | Anders Johansson | | ",
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
9b0365 | 2001-03-07 | Kenneth Johansson | | "cimg-url":#"<desc tag='tag'><p><short>
|
4b3fc0 | 2001-03-12 | Johan Sundström | | This tag generates an URL to the manipulated picture.</short>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <tag>cimg-url</tag> takes the same attributes as <xref
href='cimg.tag' />, including the image cache attributes. The use for
|
4b3fc0 | 2001-03-12 | Johan Sundström | | the tag is to insert image-URLs into various places, e.g. a
|
9b0365 | 2001-03-07 | Kenneth Johansson | | submit-box.</p>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | | </desc>
|
4b3fc0 | 2001-03-12 | Johan Sundström | | <attr name='src' value='url' required='required'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | The path to the indata file.</p>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | |
|
4b3fc0 | 2001-03-12 | Johan Sundström | | <ex><cimg-url src='/internal-roxen-testimage'/></ex>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | | </attr>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | <attr name='data' value='imagedata'><p>
|
2fafd2 | 2000-05-18 | Kenneth Johansson | | Insert images from other sources, e.g. databases through entities or
|
9b0365 | 2001-03-07 | Kenneth Johansson | | variables.</p>
|
cba1fa | 2001-08-30 | Johan Sundström | | <ex-box><emit source='sql' query='select imagedata from images where id=37'>
<cimg-url data='&sql.imagedata;'/>
</emit></ex-box>
|
5adc58 | 2009-11-30 | Henrik Grubbström (Grubba) | | </attr>
<h1>Timeout</h1>
<p>The generated image will by default never expire, but
in some circumstances it may be pertinent to limit the
time the image and its associated data is kept. Its
possible to set an (advisory) timeout on the image data
using the following attributes.</p>
<attr name='unix-time' value='number'><p>
Set the base expiry time to this absolute time.</p><p>
If left out, the other attributes are relative to current time.</p>
</attr>
<attr name='years' value='number'><p>
Add this number of years to the time this entry is valid.</p>
</attr>
<attr name='months' value='number'><p>
Add this number of months to the time this entry is valid.</p>
</attr>
<attr name='weeks' value='number'><p>
Add this number of weeks to the time this entry is valid.</p>
</attr>
<attr name='days' value='number'><p>
Add this number of days to the time this entry is valid.</p>
</attr>
<attr name='hours' value='number'><p>
Add this number of hours to the time this entry is valid.</p>
</attr>
<attr name='beats' value='number'><p>
Add this number of beats to the time this entry is valid.</p>
</attr>
<attr name='minutes' value='number'><p>
Add this number of minutes to the time this entry is valid.</p>
</attr>
<attr name='seconds' value='number'><p>
Add this number of seconds to the time this entry is valid.</p>
|
739058 | 2000-06-01 | Martin Nilsson | | </attr>",
|
0783ea | 2000-08-29 | Kenneth Johansson | |
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "emit#cimg":({ #"<desc type='plugin'><p><short>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Entitybased version of <xref href='../graphics/cimg.tag' />.</short>
Takes the same attributes as <tag>cimg</tag>.</p>
|
a0909c | 2004-10-27 | Jonas Wallden | | </desc>
<attr name='nodata' value='yes | no'><p>
Controls suppression of <ent>_.data</ent> in the output. Useful for
reducing memory consumption in cached emit tags. The default value
|
c0f552 | 2005-01-27 | Anders Johansson | | is 'no'.</p>
</attr>",
|
0783ea | 2000-08-29 | Kenneth Johansson | |
([
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.type;":#"<desc type='entity'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Returns the image's content-type.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>",
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.src;":#"<desc type='entity'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Returns the path to the indata file.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>",
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.file-size;":#"<desc type='entity'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Returns the image's file size.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>",
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.xsize;":#"<desc type='entity'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Returns the width of the image.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>",
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.ysize;":#"<desc type='entity'><p>
|
9b0365 | 2001-03-07 | Kenneth Johansson | | Returns the height of the image.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>",
|
ce8fb0 | 2001-09-21 | Johan Sundström | | "&_.data;":#"<desc type='entity'><p>
|
08b567 | 2000-09-19 | Kenneth Johansson | | Returns the imagedata given through other sources, like databases
|
9b0365 | 2001-03-07 | Kenneth Johansson | | through entities.</p>
|
0783ea | 2000-08-29 | Kenneth Johansson | | </desc>"
])
}),
|
739058 | 2000-06-01 | Martin Nilsson | | ]);
|
2e0a35 | 1999-12-09 | Martin Nilsson | | #endif
|
4afee2 | 2001-04-03 | Per Hedbor | | int do_ext;
|
fe32ad | 2001-03-30 | Johan Sundström | | void create()
{
defvar("ext", Variable.Flag(0, VAR_MORE,
"Append format to generated images",
"Append the image format (.gif, .png, "
".jpg, etc) to the generated images. "
"This is not necessary, but might seem "
"nicer, especially to people who try "
"to mirror your site."));
}
|
739058 | 2000-06-01 | Martin Nilsson | |
|
37bdda | 1999-05-18 | Per Hedbor | | void start()
{
|
1c0651 | 2007-01-17 | Jonas Wallden | |
if (the_cache) {
the_cache->set_draw_function(generate_image);
} else {
the_cache = roxen.ImageCache( "cimg", generate_image );
}
|
4afee2 | 2001-04-03 | Per Hedbor | | do_ext = query("ext");
|
37bdda | 1999-05-18 | Per Hedbor | | }
|
1c0651 | 2007-01-17 | Jonas Wallden | | void stop()
{
|
c7ba99 | 2010-04-27 | Henrik Grubbström (Grubba) | | destruct(the_cache);
|
1c0651 | 2007-01-17 | Jonas Wallden | | }
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | mapping(string:function) query_action_buttons() {
|
da4304 | 2005-12-16 | Jonas Wallden | | return ([ "Clear Cache":flush_cache ]);
|
5f13d5 | 2000-06-03 | Martin Nilsson | | }
void flush_cache() {
the_cache->flush();
|
3cca1c | 2004-05-21 | Jonas Wallden | |
cache.flush_memory_cache();
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | }
string status() {
array s=the_cache->status();
|
482ba7 | 2000-12-30 | Per Hedbor | | return sprintf("<b>Images in cache:</b> %d images<br />\n"
"<b>Cache size:</b> %s",
s[0], Roxen.sizetostring(s[1]));
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | }
|
6a613a | 2002-06-17 | Anders Johansson | | array(Image.Layer)|mapping generate_image( mapping args, RequestID id )
|
37bdda | 1999-05-18 | Per Hedbor | | {
|
689f3a | 2000-11-21 | Per Hedbor | | array layers;
|
13b35c | 2003-07-04 | Jonas Wallden | |
mapping opts = ([ "crop_to_bounds" : 1 ]);
|
689f3a | 2000-11-21 | Per Hedbor | | if( args["process-all-layers"] )
opts->draw_all_layers = 1;
|
bd2fd0 | 2001-08-15 | Per Hedbor | | if( args["jpeg-shrink" ] )
{
opts->scale_denom = (int)args["jpeg-shrink" ];
opts->scale_num = 1;
}
|
34a9b8 | 1999-08-06 | Peter Bortas | | if( args->data )
|
689f3a | 2000-11-21 | Per Hedbor | | layers = roxen.decode_layers( args->data, opts );
|
34a9b8 | 1999-08-06 | Peter Bortas | | else
|
6a613a | 2002-06-17 | Anders Johansson | | {
|
5ae0a3 | 2002-10-24 | Jonas Wallden | | mixed tmp;
#if constant(Sitebuilder)
if (Sitebuilder.sb_start_use_imagecache) {
Sitebuilder.sb_start_use_imagecache(args, id);
tmp = roxen.load_layers(args->src, id, opts);
Sitebuilder.sb_end_use_imagecache(args, id);
} else
#endif
{
tmp = roxen.load_layers(args->src, id, opts);
}
|
d86e71 | 2002-07-01 | Anders Johansson | | if (mappingp(tmp)) {
|
02d09b | 2004-05-05 | Anders Johansson | | if (tmp->error == Protocols.HTTP.HTTP_UNAUTH)
|
d86e71 | 2002-07-01 | Anders Johansson | | return tmp;
else
layers = 0;
}
|
6a613a | 2002-06-17 | Anders Johansson | | else layers = tmp;
}
|
689f3a | 2000-11-21 | Per Hedbor | |
|
7b5675 | 2001-06-25 | Marcus Wellhardh | | if(!layers)
|
bd2fd0 | 2001-08-15 | Per Hedbor | | {
if( args->data )
|
78b912 | 2012-06-21 | Martin Stjernholm | | RXML.run_error("Failed to decode specified data\n");
|
bd2fd0 | 2001-08-15 | Per Hedbor | | else
|
78b912 | 2012-06-21 | Martin Stjernholm | | RXML.run_error("Failed to load specified image [%O]\n", args->src);
|
bd2fd0 | 2001-08-15 | Per Hedbor | | }
|
d86e71 | 2002-07-01 | Anders Johansson | |
|
02d09b | 2004-05-05 | Anders Johansson | | if (!sizeof(filter(layers->image(), objectp)))
|
78b912 | 2012-06-21 | Martin Stjernholm | | RXML.run_error("Failed to decode layers in specified image [%O]\n",
args->src);
|
5715f8 | 2005-10-05 | Marcus Wellhardh | | if(!args["exclude-invisible-layers"])
layers->set_misc_value( "visible",1 );
|
930b63 | 2000-12-10 | Per Hedbor | | foreach( layers, Image.Layer lay )
if( !lay->get_misc_value( "name" ) )
lay->set_misc_value( "name", "Background" );
|
689f3a | 2000-11-21 | Per Hedbor | |
if( args["exclude-layers"] )
{
foreach( args["exclude-layers"] / ",", string match )
foreach( layers, Image.Layer lay )
if( glob( match, lay->get_misc_value( "name" ) ) )
lay->set_misc_value( "visible", 0 );
}
if( args["include-layers"] )
{
foreach( args["include-layers"] / ",", string match )
foreach( layers, Image.Layer lay )
if( glob( match, lay->get_misc_value( "name" ) ) )
lay->set_misc_value( "visible", 1 );
}
array res = ({});
foreach( layers, Image.Layer l )
{
if( l->get_misc_value( "visible" ) )
res += ({ l });
}
return res;
|
37bdda | 1999-05-18 | Per Hedbor | | }
mapping find_internal( string f, RequestID id )
{
|
4afee2 | 2001-04-03 | Per Hedbor | |
|
e44906 | 2008-10-29 | Erik Dahl | |
|
4afee2 | 2001-04-03 | Per Hedbor | |
|
e44906 | 2008-10-29 | Erik Dahl | |
sscanf (f, "%[^./]", f);
return the_cache->http_file_answer( f, id );
|
37bdda | 1999-05-18 | Per Hedbor | | }
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | mapping get_my_args( mapping args, RequestID id )
|
37bdda | 1999-05-18 | Per Hedbor | | {
|
36eceb | 2000-01-30 | Per Hedbor | | mapping a=
([
|
37bdda | 1999-05-18 | Per Hedbor | | "quant":args->quant,
|
77926b | 2000-04-11 | Per Hedbor | | "crop":args->crop,
|
c52692 | 1999-05-18 | Per Hedbor | | "format":args->format,
"maxwidth":args->maxwidth,
"maxheight":args->maxheight,
"scale":args->scale,
"dither":args->dither,
|
b941aa | 1999-06-25 | Per Hedbor | | "gamma":args->gamma,
|
34a9b8 | 1999-08-06 | Peter Bortas | | "data":args->data,
|
37bdda | 1999-05-18 | Per Hedbor | | ]);
|
77926b | 2000-04-11 | Per Hedbor | |
|
7c4b6b | 2003-09-15 | Jonas Wallden | | if( args->src ) {
|
a6f956 | 2000-09-19 | Per Hedbor | | a->src = Roxen.fix_relative( args->src, id );
|
c0acab | 2009-02-19 | Jonas Wallden | | array(int)|Stat st = (id->conf->try_stat_file(a->src, id));
|
689f3a | 2000-11-21 | Per Hedbor | | if (st)
{
string fn = id->conf->real_file( a->src, id );
if( fn ) Roxen.add_cache_stat_callback( id, fn, st[ST_MTIME] );
a->mtime = (string) (a->stat = st[ST_MTIME]);
|
1133a7 | 2000-07-07 | Henrik Grubbström (Grubba) | | a->filesize = (string) st[ST_SIZE];
|
5ae0a3 | 2002-10-24 | Jonas Wallden | |
#if constant(Sitebuilder)
|
5d41d1 | 2002-11-06 | Anders Johansson | |
|
5ae0a3 | 2002-10-24 | Jonas Wallden | |
if (Sitebuilder.sb_prepare_imagecache)
|
200780 | 2002-10-24 | Jonas Wallden | | a = Sitebuilder.sb_prepare_imagecache(a, a->src, id);
|
5ae0a3 | 2002-10-24 | Jonas Wallden | | #endif
|
1133a7 | 2000-07-07 | Henrik Grubbström (Grubba) | | }
|
7c4b6b | 2003-09-15 | Jonas Wallden | | }
|
2fa8d5 | 2000-06-02 | Martin Nilsson | |
|
1c10ca | 2000-07-05 | Per Hedbor | | a["background-color"] = id->misc->defines->bgcolor || "#eeeeee";
|
77926b | 2000-04-11 | Per Hedbor | |
|
c52692 | 1999-05-18 | Per Hedbor | | foreach( glob( "*-*", indices(args)), string n )
a[n] = args[n];
|
77926b | 2000-04-11 | Per Hedbor | |
|
34a9b8 | 1999-08-06 | Peter Bortas | | return a;
}
|
a49dae | 2000-08-17 | Per Hedbor | | mapping check_args( mapping args )
{
if( !args->format )
args->format = "png";
if( !(args->src || args->data) )
RXML.parse_error("Required attribute 'src' or 'data' missing\n");
|
314e01 | 2006-10-05 | Jonas Wallden | | if (args->src == "")
RXML.parse_error("Attribute 'src' cannot be empty\n");
|
a49dae | 2000-08-17 | Per Hedbor | | if( args->src && args->data )
RXML.parse_error("Only one of 'src' and 'data' may be specified\n");
return args;
}
class TagCimgplugin
{
inherit RXML.Tag;
constant name = "emit";
constant plugin_name = "cimg";
array get_dataset( mapping args, RequestID id )
{
mapping res = ([ ]);
mapping a = get_my_args( check_args( args ), id );
string data;
|
9363fa | 2009-11-24 | Henrik Grubbström (Grubba) | |
|
ce4deb | 2009-11-26 | Henrik Grubbström (Grubba) | | int timeout = Roxen.timeout_dequantifier(args);
|
9363fa | 2009-11-24 | Henrik Grubbström (Grubba) | |
|
21bd60 | 2004-06-16 | Anders Johansson | |
int cacheable = id->misc->cacheable;
int no_proto_cache = id->misc->no_proto_cache;
#ifdef DEBUG_CACHEABLE
report_debug("%s:%d saved cacheable flags\n", __FILE__, __LINE__);
#endif
|
9363fa | 2009-11-24 | Henrik Grubbström (Grubba) | | res->src=(query_absolute_internal_location(id)+
the_cache->store( a, id, timeout ));
|
e44906 | 2008-10-29 | Erik Dahl | | if(args->filename && sizeof(args->filename))
|
241b7e | 2008-10-29 | Erik Dahl | | res->src += "/" + Roxen.http_encode_url(args->filename);
|
4afee2 | 2001-04-03 | Per Hedbor | | if(do_ext)
|
046fc4 | 2008-12-17 | Tomas Nilsson | | res->src += "." + a->format;
|
eac60f | 2001-01-26 | Per Hedbor | | data = the_cache->data( a, id , 0 );
res["file-size"] = strlen(data);
res["file-size-kb"] = strlen(data)/1024;
|
a0909c | 2004-10-27 | Jonas Wallden | | if (lower_case(args->nodata || "no") == "no")
res["data"] = data;
|
91d017 | 2009-12-01 | Henrik Grubbström (Grubba) | | res |= the_cache->metadata( a, id, 0, timeout );
|
21bd60 | 2004-06-16 | Anders Johansson | | #ifdef DEBUG_CACHEABLE
report_debug("%s:%d restored cacheable flags\n", __FILE__, __LINE__);
#endif
id->misc->cacheable = cacheable;
id->misc->no_proto_cache = no_proto_cache;
|
eac60f | 2001-01-26 | Per Hedbor | | return ({ res });
|
a49dae | 2000-08-17 | Per Hedbor | | }
}
class TagCImg
{
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | inherit RXML.Tag;
constant name = "cimg";
|
1b2d74 | 2001-10-08 | Anders Johansson | | constant flags = RXML.FLAG_EMPTY_ELEMENT;
|
2fa8d5 | 2000-06-02 | Martin Nilsson | |
|
fe32ad | 2001-03-30 | Johan Sundström | | class Frame
|
a49dae | 2000-08-17 | Per Hedbor | | {
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | inherit RXML.Frame;
|
a49dae | 2000-08-17 | Per Hedbor | | array do_return(RequestID id)
{
|
ce4deb | 2009-11-26 | Henrik Grubbström (Grubba) | | int timeout = Roxen.timeout_dequantifier(args);
|
a49dae | 2000-08-17 | Per Hedbor | | mapping a = get_my_args( check_args( args ), id );
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | args -= a;
|
fe32ad | 2001-03-30 | Johan Sundström | | string ext = "";
|
e44906 | 2008-10-29 | Erik Dahl | | string filename = "";
if(args->filename && sizeof(args->filename))
|
241b7e | 2008-10-29 | Erik Dahl | | filename += "/" + Roxen.http_encode_url(m_delete(args, "filename"));
|
4afee2 | 2001-04-03 | Per Hedbor | | if(do_ext)
|
046fc4 | 2008-12-17 | Tomas Nilsson | | ext = "." + a->format;
|
241b7e | 2008-10-29 | Erik Dahl | | args->src = query_absolute_internal_location( id )
|
9363fa | 2009-11-24 | Henrik Grubbström (Grubba) | | + the_cache->store( a, id, timeout ) + filename + ext;
|
5701ac | 2003-10-17 | Anders Johansson | | int no_draw = !id->misc->generate_images;
|
94a615 | 2009-01-08 | Stephen R. van den Berg | | mapping size;
if( !args->width && !args->height
|
91d017 | 2009-12-01 | Henrik Grubbström (Grubba) | | && (size = the_cache->metadata( a, id, no_draw, timeout )) )
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | {
|
cf5b11 | 2003-10-16 | Anders Johansson | |
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | args->width = size->xsize;
args->height = size->ysize;
}
|
0023a6 | 2000-08-22 | Martin Nilsson | | int xml=!args->noxml;
m_delete(args, "noxml");
result = Roxen.make_tag( "img", args, xml );
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | return 0;
}
|
37bdda | 1999-05-18 | Per Hedbor | | }
}
|
698c12 | 1999-05-19 | Peter Bortas | |
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | class TagCImgURL {
inherit RXML.Tag;
constant name = "cimg-url";
|
1b2d74 | 2001-10-08 | Anders Johansson | | constant flags = RXML.FLAG_EMPTY_ELEMENT;
|
2fa8d5 | 2000-06-02 | Martin Nilsson | |
|
a49dae | 2000-08-17 | Per Hedbor | | class Frame
{
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | inherit RXML.Frame;
|
4b3fc0 | 2001-03-12 | Johan Sundström | | array do_return(RequestID id)
|
a49dae | 2000-08-17 | Per Hedbor | | {
|
ce4deb | 2009-11-26 | Henrik Grubbström (Grubba) | | int timeout = Roxen.timeout_dequantifier(args);
|
e44906 | 2008-10-29 | Erik Dahl | | string filename = "";
|
046fc4 | 2008-12-17 | Tomas Nilsson | | mapping a = get_my_args (check_args (args), id);
|
6e8436 | 2009-07-08 | Anders Johansson | | if(args->filename && sizeof(args->filename))
filename = "/" + Roxen.http_encode_url(args->filename);
|
241b7e | 2008-10-29 | Erik Dahl | | result = query_absolute_internal_location(id)
|
9363fa | 2009-11-24 | Henrik Grubbström (Grubba) | | + the_cache->store(a, id, timeout)
|
241b7e | 2008-10-29 | Erik Dahl | | + filename
|
046fc4 | 2008-12-17 | Tomas Nilsson | | + (do_ext ? "." + a->format : "");
|
2fa8d5 | 2000-06-02 | Martin Nilsson | | return 0;
}
}
|
698c12 | 1999-05-19 | Peter Bortas | | }
|