You are here

function _mimemail_imagecache in Mime Mail 6

Helper function to ensure that ImageCache files are created before attaching.

1 call to _mimemail_imagecache()
_mimemail_file in ./mimemail.inc
Helper function to extract local files.

File

./mimemail.inc, line 224
Common mail functions for sending e-mail. Originally written by Gerhard.

Code

function _mimemail_imagecache($url) {
  static $urls = array();

  // Prevent rechecking.
  if (isset($urls[$url])) {
    return;
  }
  $segments = explode('/', $url);

  // Extract the preset from the path.
  $key = array_search('imagecache', $segments);
  $preset = $segments[$key + 1];

  // Remove unnecessary segments to get the original path.
  unset($segments[$key], $segments[$key + 1]);
  $path = implode('/', $segments);
  $urls[$url] = TRUE;
  return imagecache_generate_image($preset, $path);
}