You are here

function media_watermark_add_watermark in Media watermark 7

Callback to add watermark.

1 string reference to 'media_watermark_add_watermark'
media_watermark_form_alter in ./media_watermark.module
Implements hook_form_alter().

File

./media_watermark.module, line 175
Watermark media module.

Code

function media_watermark_add_watermark(&$form, &$form_state) {
  if ($form_state['values']['add_watermark']) {

    // Uploaded file.
    if (is_object($form_state['values']['upload'])) {
      $file_path = drupal_realpath($form_state['values']['upload']->uri);
      media_watermark_create_image($file_path, $form_state);
    }
    elseif (is_int($form_state['values']['upload']) || is_string($form_state['values']['upload'])) {
      $uploaded = file_load($form_state['values']['upload']);
      $file_path = drupal_realpath($uploaded->uri);
      media_watermark_create_image($file_path, $form_state);
    }
    else {
      media_watermark_add_upload_multiple_submit($form, $form_state);
    }
  }
}