You are here

function imageapi_optimize_tinypng_validate_api_key in Image Optimize (or ImageAPI Optimize) 7

Validation callback for tinyPNG API key. Just check that the key entered has 32-char length.

1 string reference to 'imageapi_optimize_tinypng_validate_api_key'
imageapi_optimize_services_tinypng_form in services/tinypng.inc
TinyPNG ImageAPI Optimize form callback.

File

services/tinypng.inc, line 63
tinypng API service integration.

Code

function imageapi_optimize_tinypng_validate_api_key($element, &$form_state, $form) {
  if ($form_state['values']['image_toolkit'] == 'imageapi_optimize' && $form_state['values']['imageapi_optimize_service'] == 'tinypng' && strlen($element['#value']) != 32) {
    form_error($element, t('TinyPNG API key must have 32-char length.'));
  }
}