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 - 2004, Roxen IS.   //      #include <module.h>   inherit "module";   constant thread_safe=1;      roxen.ImageCache the_cache;    - constant cvs_version = "$Id: cimg.pike,v 1.67 2004/06/30 16:59:03 mast Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.68 2004/09/21 15:35:27 mast 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:152:    cache.flush_memory_cache();   }      string status() {    array s=the_cache->status();    return sprintf("<b>Images in cache:</b> %d images<br />\n"    "<b>Cache size:</b> %s",    s[0], Roxen.sizetostring(s[1]));   }    + void image_error (string fmt, mixed... args) + { +  if (RXML_CONTEXT) +  // generate_image can be called from within the cimg tag if +  // id->misc->generate_images is set. +  RXML.run_error (fmt, @args); +  else +  error (fmt, @args); + } +    array(Image.Layer)|mapping generate_image( mapping args, RequestID id )   {    array layers;       // Photoshop layers: don't let individual layers expand the image    // beyond the bounds of the overall image.    mapping opts = ([ "crop_to_bounds" : 1 ]);       if( args["process-all-layers"] )    opts->draw_all_layers = 1;
Roxen.git/server/modules/graphics/cimg.pike:198:    return tmp;    else    layers = 0;    }    else layers = tmp;    }       if(!layers)    {    if( args->data ) -  error("Failed to decode specified data\n"); +  image_error("Failed to decode specified data\n");    else -  error("Failed to load specified image [%O]\n", args->src); +  image_error("Failed to load specified image [%O]\n", args->src);    }       if (!sizeof(filter(layers->image(), objectp))) -  error("Failed to decode layers in specified image [%O]\n", args->src); +  image_error("Failed to decode layers in specified image [%O]\n", args->src);       layers->set_misc_value( "visible",1 );    foreach( layers, Image.Layer lay )    if( !lay->get_misc_value( "name" ) )    lay->set_misc_value( "name", "Background" );       if( args["exclude-layers"] )    {    foreach( args["exclude-layers"] / ",", string match )    foreach( layers, Image.Layer lay )