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 - 2001, Roxen IS.   //      #include <module.h>   inherit "module";   constant thread_safe=1;      roxen.ImageCache the_cache;    - constant cvs_version = "$Id: cimg.pike,v 1.58 2003/09/08 14:07:49 anders Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.59 2003/09/15 12:05:07 jonasw 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:245:    "crop":args->crop,    "format":args->format,    "maxwidth":args->maxwidth,    "maxheight":args->maxheight,    "scale":args->scale,    "dither":args->dither,    "gamma":args->gamma,    "data":args->data,    ]);    -  if( args->src ) -  catch +  if( args->src ) { +  mixed err = catch    {    a->src = Roxen.fix_relative( args->src, id );    array(int)|Stat st = (id->conf->try_stat_file(a->src, id) ||    file_stat(a->src));    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]);    a->filesize = (string) st[ST_SIZE];      #if constant(Sitebuilder)    // The file we called try_stat_file() on above may be a SiteBuilder    // file. If so we need to extend the argument data with e.g.    // current language fork.    if (Sitebuilder.sb_prepare_imagecache)    a = Sitebuilder.sb_prepare_imagecache(a, a->src, id);   #endif    }    }; -  + #ifdef DEBUG +  if (err) +  report_error("<cimg> or <emit#cimg>: error in get_my_args(): %s\n", +  describe_backtrace(err)); + #endif +  }       a["background-color"] = id->misc->defines->bgcolor || "#eeeeee";       foreach( glob( "*-*", indices(args)), string n )    a[n] = args[n];       return a;   }      mapping check_args( mapping args )
Roxen.git/server/modules/graphics/cimg.pike:299:   {    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; -  catch // This code will fail if the image does not exist. +  mixed err = catch // This code will fail if the image does not exist.    {    res->src=(query_absolute_internal_location(id)+the_cache->store( a,id ));    if(do_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 });    }; -  + #ifdef DEBUG +  report_error("<emit#cimg> error in get_dataset(): %s\n", +  describe_backtrace(err)); + #endif    RXML.parse_error( "Illegal arguments or image\n" );    return ({});    }   }      class TagCImg   {    inherit RXML.Tag;    constant name = "cimg";    constant flags = RXML.FLAG_EMPTY_ELEMENT;