You are here

public function ImceFM::getFileProperties in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/ImceFM.php \Drupal\imce\ImceFM::getFileProperties()

Returns js properties of a file.

1 call to ImceFM::getFileProperties()
ImceFM::addItemToJs in src/ImceFM.php
Add an item to the response.

File

src/ImceFM.php, line 459

Class

ImceFM
Imce File Manager.

Namespace

Drupal\imce

Code

public function getFileProperties($uri) {
  $properties = [
    'date' => filemtime($uri),
    'size' => filesize($uri),
  ];
  if (preg_match('/\\.(jpe?g|png|gif)$/i', $uri) && ($info = getimagesize($uri))) {
    $properties['width'] = $info[0];
    $properties['height'] = $info[1];
    $style = $this
      ->getThumbnailStyle();
    if ($style && strpos($uri, '/styles/') === FALSE) {
      $properties['thumbnail'] = $style
        ->buildUrl($uri);
    }
  }
  return $properties;
}