/**
  * Given a File object, create an array of its properties and values
  * ready to be transformed to JSON
  * 	
  * @param  Folder $folder
  * @return array
  */
 public function createFileJSON(File $file, $folder = null)
 {
     $isImage = $file instanceof Image;
     $w = $isImage ? self::IMAGE_WIDTH : self::ICON_SIZE;
     $h = $isImage ? self::IMAGE_HEIGHT : self::ICON_SIZE;
     $folder = $folder ?: $file->Parent();
     return array('id' => $file->ID, 'parentID' => $file->ParentID, 'title' => $file->Title, 'filename' => basename($file->Filename), 'path' => $file->Filename, 'filesize' => $file->getAbsoluteSize(), 'folderName' => $folder->Filename, 'type' => $isImage ? 'image' : 'file', 'extension' => $file->getExtension(), 'created' => $file->Created, 'updated' => $file->LastEdited, 'iconURL' => $file->getPreviewThumbnail($w, $h)->URL, 'canEdit' => $file->canEdit(), 'canCreate' => $file->canCreate(), 'canDelete' => $file->canDelete());
 }
 /**
  * Adds new properties to the parent (KickAssets) file JSON
  * 
  * @return array
  */
 protected function buildJSON()
 {
     $json = $this->parent->createFileJSON($this->file);
     $json['created'] = $this->file->obj('Created')->FormatFromSettings();
     $json['lastEdited'] = $this->file->obj('LastEdited')->FormatFromSettings();
     $json['url'] = $this->file->getAbsoluteURL();
     $json['size'] = $this->file->getSize();
     $json['folder'] = $this->file->Parent()->Filename;
     if ($this->file instanceof Image) {
         $preview = $this->file->CroppedImage(400, 133);
         $detail = $this->file->getKickAssetsDetailImage();
         $json['previewImage'] = $preview ? $preview->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
         $json['detailImage'] = $detail ? $detail->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
     }
     return $json;
 }