You are here

public function AFile::getData in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

File

vendor/edsdk/file-uploader-server-php/src/lib/file/AFile.php, line 32

Class

AFile

Namespace

EdSDK\FileUploaderServer\lib\file

Code

public function getData() {
  $data = new FileData();
  $data->isCommited = $this
    ->isCommited();
  $data->name = $this
    ->getName();
  $data->dir = $this
    ->getDir();
  $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();
    if ($data->isCommited) {
      if ($this->m_mainFile === null) {

        // m_mainFile is property of FileCommited
        $modifications = $this
          ->getModifications();
        for ($i = 0; $i < count($modifications); $i++) {
          $data->sizes[$modifications[$i]
            ->getModificationName()] = $modifications[$i]
            ->getData();
        }
      }
    }
  }
  return $data;
}