function image_effects_text_exit in ImageCache Actions 7
Same name and namespace in other branches
- 8 image_effects_text/image_effects_text.module \image_effects_text_exit()
Implements hook_exit().
For imagemagick we place the text in a temporary file as this prevents problems with non-ASCII characters. This hook deletes files created during execution of the text effect. As a style may contain multiple text effects, there may be multiple files to delete.
To keep track of temporary files created by this effect, the image effect function itself also calls this hook, but passes the filename as a parameter.
Parameters
string|null $destination:
1 call to image_effects_text_exit()
- image_imagemagick_image_effects_text in image_effects_text/
image_effects_text.inc - Imagemagick toolkit specific implementation of the text effect.
File
- image_effects_text/
image_effects_text.module, line 84 - Provide text manipulation effects for image styles.
Code
function image_effects_text_exit($destination = NULL) {
static $tmp_file_names = array();
if (isset($destination)) {
if (substr($destination, 0, strlen('temporary://')) === 'temporary://') {
// Called by the effect function. Add to our static list of files ot delete.
$tmp_file_names[] = $destination;
}
}
else {
// Normal invocation as Drupal hook: delete any files we have collected.
foreach ($tmp_file_names as $tmp_file_name) {
unlink($tmp_file_name);
}
}
}