You are here

function imagecache_generate_image in ImageCache 6.2

Generate a derivative image given presetname and filepath.

This is a developer friendly version of _imagecache_cache(), it doesn't worry about sending HTTP headers or an image back to the client so it's much simpler.

Parameters

$presetname: ImageCache preset array.

$filepath: String filepath from the files table.

Return value

A Boolean indicating if the operation succeeded.

3 calls to imagecache_generate_image()
imagecache_drush_preset_build in ./imagecache.drush.inc
Drush callback to perform actual imagecache preset build.
imagecache_generate_action in ./imagecache.module
Generate imagecache presets for the given node and presets.
imagecache_generate_all_action in ./imagecache.module
Generate all imagecache presets for the given node.

File

./imagecache.module, line 1333
Dynamic image resizer and image cacher.

Code

function imagecache_generate_image($presetname, $filepath) {
  $preset = imagecache_preset_by_name($presetname);
  if (empty($preset['presetname'])) {
    return FALSE;
  }
  $destination = imagecache_create_path($preset['presetname'], $filepath);
  if (file_exists($destination)) {
    return TRUE;
  }
  return imagecache_build_derivative($preset['actions'], $filepath, $destination);
}