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 - 2009, Roxen IS.   //      #include <module.h>   inherit "module";   constant thread_safe=1;      roxen.ImageCache the_cache;    - constant cvs_version = "$Id: cimg.pike,v 1.83 2009/11/24 15:17:33 grubba Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.84 2009/11/26 15:12:33 grubba 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:373:    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;    -  int timeout = UNDEFINED; -  if (args["unix-time"]) { -  timeout = (int)args["unix-time"] - time(1); -  } -  timeout = Roxen.time_dequantifier(args, timeout); -  if (!zero_type(timeout)) { -  // Clean up the args mapping. -  foreach(({ "unix-time", "seconds", "minutes", "beats", "hours", -  "days", "weeks", "months", "years" }), string arg) { -  m_delete(args, arg); -  } -  // Make sure the timeout is positive (and reasonable). -  if (timeout < 60) timeout = 60; -  } +  int timeout = Roxen.timeout_dequantifier(args);       mixed err = catch // This code will fail if the image does not exist.    {    // Store misc->cacheable since the image cache can raise it and    // disable protocol cache.    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
Roxen.git/server/modules/graphics/cimg.pike:437:    inherit RXML.Tag;    constant name = "cimg";    constant flags = RXML.FLAG_EMPTY_ELEMENT;       class Frame    {    inherit RXML.Frame;       array do_return(RequestID id)    { -  int timeout = UNDEFINED; -  if (args["unix-time"]) { -  timeout = (int)args["unix-time"] - time(1); -  } -  timeout = Roxen.time_dequantifier(args, timeout); -  if (!zero_type(timeout)) { -  // Clean up the args mapping. -  foreach(({ "unix-time", "seconds", "minutes", "beats", "hours", -  "days", "weeks", "months", "years" }), string arg) { -  m_delete(args, arg); -  } -  // Make sure the timeout is positive (and reasonable). -  if (timeout < 60) timeout = 60; -  } +  int timeout = Roxen.timeout_dequantifier(args);    mapping a = get_my_args( check_args( args ), id );    args -= a;    string ext = "";    string filename = "";    if(args->filename && sizeof(args->filename))    filename += "/" + Roxen.http_encode_url(m_delete(args, "filename"));    if(do_ext)    ext = "." + a->format;    args->src = query_absolute_internal_location( id )    + the_cache->store( a, id, timeout ) + filename + ext;
Roxen.git/server/modules/graphics/cimg.pike:489:    inherit RXML.Tag;    constant name = "cimg-url";    constant flags = RXML.FLAG_EMPTY_ELEMENT;       class Frame    {    inherit RXML.Frame;       array do_return(RequestID id)    { -  int timeout = UNDEFINED; -  if (args["unix-time"]) { -  timeout = (int)args["unix-time"] - time(1); -  } -  timeout = Roxen.time_dequantifier(args, timeout); -  if (!zero_type(timeout)) { -  // Clean up the args mapping. -  foreach(({ "unix-time", "seconds", "minutes", "beats", "hours", -  "days", "weeks", "months", "years" }), string arg) { -  m_delete(args, arg); -  } -  // Make sure the timeout is positive (and reasonable). -  if (timeout < 60) timeout = 60; -  } +  int timeout = Roxen.timeout_dequantifier(args);    string filename = "";    mapping a = get_my_args (check_args (args), id);       if(args->filename && sizeof(args->filename))    filename = "/" + Roxen.http_encode_url(args->filename);    result = query_absolute_internal_location(id)    + the_cache->store(a, id, timeout)    + filename    + (do_ext ? "." + a->format : "");    return 0;    }    }   }