[pmwiki-devel] php imagepng

Patrick R. Michaud pmichaud at pobox.com
Wed Nov 8 11:26:03 CST 2006


On Wed, Nov 08, 2006 at 04:16:12PM +0000, Hans wrote:
> Wednesday, November 8, 2006, 4:15:55 PM, Patrick wrote:
> 
> > No.  AFAIK, the (only) way the browser knows to display an image
> > is by using an <img ... /> tag or something equivalent that does
> > a separate fetch of the image -- there's not a way to embed raw 
> > image data directly into an HTML document.  
> 
> > It's just the way HTML is designed/written.
> 
> Thank you. Then I think it may be best to have imagepng create a file,
> perhaps in the cache/ folder, and refer to this image file in an img
> tag inserted.

FWIW, for any recipes that may want to have cached files publicly
available, I recommend the following sequence:

    SDV($PubCacheDir, "pub/cache");
    SDV($PubCacheUrl, "$PubDirUrl/cache");
    SDV($MyRecipeCacheDir, $PubCacheDir);
    SDV($MyRecipeCacheUrl, $PubCacheUrl);
    mkdirp($MyRecipeCacheDir);

Then have the recipe use $MyRecipeCacheDir/$MyRecipeCacheUrl
when dealing with cached files.  (Rename $MyRecipe... to something
appropriate for the recipe.)

The first two set default values of $PubCacheDir and $PubCacheUrl,
which are the convention place to put publicly cached files.
The second two use those to create recipe-specific cache
directories and urls.

This setup means that an administrator can globally configure
a cache directory using the variables $PubCacheDir and $PubCacheUrl, 
while still allowing per-recipe directories for sites that may want
that.

Pm



More information about the pmwiki-devel mailing list