You are here

function swftools_get_info in SWF Tools 6.3

Same name and namespace in other branches
  1. 5 swftools.module \swftools_get_info()
  2. 6 swftools.module \swftools_get_info()
  3. 6.2 swftools.module \swftools_get_info()

Returns information about the specified file.

We use this function to try and get the height and width for content that we don't have a specific size for.

The returned value is an array that may include width, height, extension, file_size, mime_type. We return FALSE if we didn't get a valid file, or if image_get_info() couldn't tell us anything.

@parameter string $file Path to a local file that we want to interrogate.

Return value

mixed An array of data, or FALSE if we didn't get anything.

2 calls to swftools_get_info()
swftools_image_html_alt in ./swftools.module
Replaces the html_alt string with an image tag when rendering an image playlist.
swftools_set_size in ./swftools.module
Helper function to set the size of the swf content in to $options['othervars']['height'] and ['width']

File

./swftools.module, line 691
The primary component of SWF Tools that enables comprehensive media handling.

Code

function swftools_get_info($file) {

  // Assume we won't have data
  $info = FALSE;

  // Try to get image info (first assume it is in the file directory (most likely case))
  if ($try = file_create_path($file)) {
    $info = image_get_info($try);
  }

  // If it wasn't in the file system just try the file path - that might be valid
  if (!$info) {
    $info = image_get_info($file);
  }

  // Return either the info array, or it will be FALSE if we got nothing
  return $info;
}