Roxen.git / server / modules / graphics / cimg.pike

version» Context lines:

Roxen.git/server/modules/graphics/cimg.pike:1:   // This is a roxen module. Copyright © 1999 - 2000, Roxen IS.   //      #include <module.h>   inherit "module";   constant thread_safe=1;      roxen.ImageCache the_cache;    - constant cvs_version = "$Id: cimg.pike,v 1.39 2001/03/12 10:14:46 jhs Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.40 2001/03/30 11:35:46 jhs Exp $";   constant module_type = MODULE_TAG;   constant module_name = "Graphics: Image converter";   constant module_doc = "Provides the tag <tt>&lt;cimg&gt;</tt> that can be used "   "to convert images between different image formats.";         mapping tagdocumentation()   {    Stdio.File file=Stdio.File();    if(!file->open(__FILE__,"r")) return 0;
Roxen.git/server/modules/graphics/cimg.pike:103: Inside #if defined(manual)
   Returns the imagedata given through other sources, like databases    through entities.</p>   </desc>"   ])      }),      ]);   #endif    + 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.")); + }      void start()   {    the_cache = roxen.ImageCache( "cimg", generate_image );   }      mapping(string:function) query_action_buttons() {    return ([ "Clear cache":flush_cache ]);   }   
Roxen.git/server/modules/graphics/cimg.pike:168:    foreach( layers, Image.Layer l )    {    if( l->get_misc_value( "visible" ) )    res += ({ l });    }    return res;   }      mapping find_internal( string f, RequestID id )   { +  if(strlen(f)>4 && query("ext") && f[-4]=='.') // Remove .ext +  f = f[..strlen(f)-5];    return the_cache->http_file_answer( f, id );   }      mapping get_my_args( mapping args, RequestID id )   {    mapping a=    ([    "quant":args->quant,    "crop":args->crop,    "format":args->format,
Roxen.git/server/modules/graphics/cimg.pike:234:    constant plugin_name = "cimg";       array get_dataset( mapping args, RequestID id )    {    mapping res = ([ ]);    mapping a = get_my_args( check_args( args ), id );    string data;    catch // This code will fail if the image does not exist.    {    res->src=(query_absolute_internal_location(id)+the_cache->store( a,id )); +  if(query("ext")) +  res->src += "." + (a->format || "gif");    data = the_cache->data( a, id , 0 );    res["file-size"] = strlen(data);    res["file-size-kb"] = strlen(data)/1024;    res["data"] = data;    res |= the_cache->metadata( a, id, 0 ); // enforce generation    return ({ res });    };    RXML.parse_error( "Illegal arguments or image" );    return ({});    }
Roxen.git/server/modules/graphics/cimg.pike:260:    constant flags = RXML.FLAG_EMPTY_ELEMENT;       class Frame    {    inherit RXML.Frame;       array do_return(RequestID id)    {    mapping a = get_my_args( check_args( args ), id );    args -= a; -  args->src=query_absolute_internal_location(id)+the_cache->store( a,id ); +  string ext = ""; +  if(query("ext")) +  ext = "." + (a->format || "gif"); +  args->src = query_absolute_internal_location( id ) +  + the_cache->store( a, id ) + ext;    if( mapping size = the_cache->metadata( a, id, 1 ) )    {    // image in cache (1 above prevents generation on-the-fly)    args->width = size->xsize;    args->height = size->ysize;    }    int xml=!args->noxml;    m_delete(args, "noxml");    result = Roxen.make_tag( "img", args, xml );    return 0;
Roxen.git/server/modules/graphics/cimg.pike:286:    inherit RXML.Tag;    constant name = "cimg-url";    constant flags = RXML.FLAG_EMPTY_ELEMENT;       class Frame    {    inherit RXML.Frame;       array do_return(RequestID id)    { -  result = query_absolute_internal_location(id)+ -  the_cache->store(get_my_args(check_args( args ), id ),id); +  result = query_absolute_internal_location(id) +  + the_cache->store(get_my_args(check_args( args ), id ), id) +  + (query("ext") ? "" : "." + (args->format || "gif"));    return 0;    }    }   }