/**
  * Safely encodes the File object with all standard fields required
  * by the front end
  *
  * @param string $filename
  * @param string $hash
  * @param string $variant
  * @return array Encoded list of file attributes
  */
 protected function encodeAssetAttributes($filename, $hash, $variant)
 {
     // Force regeneration of file thumbnail for this tuple (without saving into db)
     $object = DBFile::create();
     $object->setValue(array('Filename' => $filename, 'Hash' => $hash, 'Variant' => $variant));
     return array('filename' => $filename, 'hash' => $hash, 'variant' => $variant, 'name' => $object->getBasename(), 'url' => $object->getURL(), 'thumbnail_url' => $object->ThumbnailURL($this->getPreviewMaxWidth(), $this->getPreviewMaxHeight()), 'size' => $object->getAbsoluteSize(), 'type' => File::get_file_type($object->getFilename()), 'buttons' => (string) $this->renderWith($this->getTemplateFileButtons()), 'fieldname' => $this->getName());
 }