You are here

function textimage_save_image in Textimage 7.2

Todo.

2 calls to textimage_save_image()
textimage_build_image in ./textimage.module
Todo.
textimage_build_preview in ./textimage.module
Todo.

File

./textimage.module, line 434
Provides text to image manipulations.

Code

function textimage_save_image($image, $file_path, $format) {
  global $user;
  $file_path = "{$file_path}.{$format}";
  textimage_directory_check($file_path);
  $file = file_save_data('', $file_path, FILE_EXISTS_REPLACE);
  $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
  $image_function = "image{$format}";
  if (function_exists($image_function)) {
    $image_function($image, $wrapper
      ->realpath());
    imagedestroy($image);
    clearstatcache();
  }
  $file->uid = $user->uid;
  $file->filemime = "image/{$format}";
  $file = file_save($file);
  return $file_path;
}