You are here

public function FileUploadedQuick::getData in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Gets a data for response format file representation.

Overrides AFile::getData

File

src/Flmngr/FileUploaderServer/lib/file/FileUploadedQuick.php, line 185

Class

FileUploadedQuick

Namespace

Drupal\n1ed\Flmngr\FileUploaderServer\lib\file

Code

public function getData() {
  $data = new FileData();
  $data->name = $this->name;
  $data->dir = $this->relativePath;
  $data->bytes = $this
    ->getSize();
  $errors = $this
    ->getErrors();
  $data->errors = [];
  for ($i = 0; $i < count($errors); $i++) {
    $data->errors[] = (array) $errors[$i];
  }
  $data->isImage = $this
    ->isImage();
  $data->sizes = [];
  if ($data->isImage) {
    $data->width = $this
      ->getImageWidth();
    $data->height = $this
      ->getImageHeight();
  }
  return $data;
}