Roxen.git/
server/
modules/
graphics/
cimg.pike
Branch:
Tag:
Non-build tags
All tags
No tags
1999-08-06
1999-08-06 02:54:47 by Peter Bortas <zino@lysator.liu.se>
34a9b8f450e4fc34cdd25d27dce66cbba60c94e6 (
37
lines) (+
16
/-
21
)
[
Show
|
Annotate
]
Branch:
5.2
Added data-argument and removed some unessesary code.
Rev: server/modules/graphics/cimg.pike:1.5
23:
mapping generate_image( mapping args, RequestID id ) {
+
if( args->data )
+
return roxen.low_decode_image( args->data );
+
else
return roxen.low_load_image( args->src, id );
-
// if( i->img && args->gamma )
-
// i->img = i->img->gamma( (float)args->gamma );
+
} mapping find_internal( string f, RequestID id )
33:
return the_cache->http_file_answer( f, id ); }
-
string
tag
_
cimg
(
string t,
mapping args,
RequestID
id )
+
mapping
get
_
my_args
( mapping args,
object
id )
{
-
mapping a
=
-
([
-
"src":fix_relative( args->src, id ),
+
mapping a=([
+
"src":
(args->src?
fix_relative( args->src, id )
:0)
,
"quant":args->quant, "format":args->format, "maxwidth":args->maxwidth,
45:
"scale":args->scale, "dither":args->dither, "gamma":args->gamma,
+
"data":args->data,
]);
-
+
foreach( glob( "*-*", indices(args)), string n ) a[n] = args[n];
-
+
return a;
+
}
-
+
string tag_cimg( string t, mapping args, RequestID id )
+
{
+
mapping a = get_my_args( args, id );
+
args -= a; args->src = query_internal_location()+the_cache->store( a );
-
+
if( mapping size = the_cache->metadata( a, id, 1 ) ) { // image in cache (1 above prevents generation on-the-fly)
65:
string tag_cimg_url( string t, mapping args, RequestID id ) {
-
mapping a =
-
([
-
"src":fix_relative( args->src, id ), "quant":args->quant,
-
"format":args->format, "maxwidth":args->maxwidth,
-
"maxheight":args->maxheight, "scale":args->scale,
-
"dither":args->dither, "gamma":args->gamma,
-
]);
-
-
foreach( glob( "*-*", indices(args)), string n )
-
a[n] = args[n];
-
-
return query_internal_location()+the_cache->store(
a
);
+
return query_internal_location()+the_cache->store(
get_my_args(
args,id
)
)
;
}