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.74 2006/10/05 09:02:25 jonasw Exp $"; + constant cvs_version = "$Id: cimg.pike,v 1.75 2007/01/17 12:45:26 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:141:    "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()   { +  // Reuse previous cache object if possible +  if (the_cache) { +  // Update reference to callback function in case we've been reloaded +  the_cache->set_draw_function(generate_image); +  } else {    the_cache = roxen.ImageCache( "cimg", generate_image ); -  +  }    do_ext = query("ext");   }    -  + void stop() + { +  // Force cache object to be recreated in start() +  the_cache = 0; + } +    mapping(string:function) query_action_buttons() {    return ([ "Clear Cache":flush_cache ]);   }      void flush_cache() {    the_cache->flush();       // It's possible that user code contains a number of stale URLs in    // e.g. <cache> blocks so we can just as well flush the RAM cache to    // reduce the risk of broken images.