You are here

function get_file_dimensions in Quiz 6.6

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

determines the x and y size of the given file

Parameters

string $file the filename :

Return value

array looks like array('x'=>171, 'y'=>323), or array('x'=>0, 'y'=>0) if size can't be determined

File

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

Code

function get_file_dimensions($file) {
  $imginfo = @getimagesize($file);
  if ($imginfo !== FALSE) {
    return array(
      'x' => $imginfo[0],
      'y' => $imginfo[1],
    );
  }
  else {
    return array(
      'x' => 0,
      'y' => 0,
    );
  }
}