Ejemplo n.º 1
0
 /**
  * @param Parameter $parameter
  * @param File|null $file
  * @return string
  */
 protected function renderImagePreservation(Parameter $parameter, File $file = null)
 {
     if ($file === null) {
         return '';
     }
     return (string) new Element('p', [], [new Element('input', ['type' => 'hidden', 'name' => $parameter->getName() . '[name]', 'value' => $file->getName()]), new Element('input', ['type' => 'hidden', 'name' => $parameter->getName() . '[type]', 'value' => $file->getType()]), new Element('input', ['type' => 'hidden', 'name' => $parameter->getName() . '[data]', 'value' => base64_encode($file->getContent())]), (new FileRenderer())->render($file)]);
 }
Ejemplo n.º 2
0
 protected function createUrl(File $file)
 {
     return 'data:' . $file->getType() . ';base64,' . base64_encode($file->getContent());
 }
Ejemplo n.º 3
0
 /**
  * @param null|File $picture
  */
 public function setPicture(File $picture = null)
 {
     $this->picture = $picture ? ['name' => $picture->getName(), 'type' => $picture->getType(), 'data' => base64_encode($picture->getContent())] : null;
 }