You are here

function galleria_validate_file_extensions in Galleria 6

Helper to ensure file extension is an image.

1 call to galleria_validate_file_extensions()
galleria_is_valid in ./galleria.module
Check that the node is a valid Galleria.

File

./galleria.module, line 33
Turns a node into a Galleria image gallery.

Code

function galleria_validate_file_extensions($files) {
  $allowed_extensions = explode(',', GALLERIA_ALLOWED_EXT);

  // check each file extension
  foreach ($files as $file) {
    $ext = strtolower(substr($file->filename, -4));
    if (substr($ext, 0, 1) == '.') {
      $ext = substr($ext, 1, 3);
    }
    if (in_array($ext, $allowed_extensions, TRUE)) {
      return TRUE;
    }
  }
  return FALSE;
}