You are here

function is_image_by_extension in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 includes/moodle/question/format/qti2/qt_common.php \is_image_by_extension()

determines whether or not a file is an image, based on the file extension

Parameters

string $file the filename:

Return value

boolean

1 call to is_image_by_extension()
get_media_tag in includes/moodle/question/format/qti2/qt_common.php
creates a media tag to use for choice media

File

includes/moodle/question/format/qti2/qt_common.php, line 40

Code

function is_image_by_extension($file) {
  $extensionsregex = '/\\.(gif|jpg|jpeg|jpe|png|tif|tiff|bmp|xbm|rgb|svf)$/';
  if (preg_match($extensionsregex, $file)) {
    return true;
  }
  return false;
}