Ejemplo n.º 1
0
 protected function generatePage()
 {
     $content = parent::generatePage();
     //Embed images
     // We do it after generation so we can catch the images that were in html already
     $content = (new EmbedImages($this->params['tree']))->embed($content, $this->file, function ($src, array $attributes, Raw $file) {
         $filename = basename($file->getPath());
         //Add the attachment for later upload
         $this->attachments[] = ['filename' => $filename, 'file' => $file];
         return $this->createImageTag($filename, $attributes);
     });
     return $content;
 }
Ejemplo n.º 2
0
 protected function generatePage()
 {
     $content = parent::generatePage();
     //Embed images
     // We do it after generation so we can catch the images that were in html already
     $content = (new EmbedImages($this->params['tree']))->embed($content, $this->file, function ($src, array $attributes, Raw $file) {
         $content = base64_encode(file_get_contents($file->getPath()));
         $attr = '';
         foreach ($attributes as $name => $value) {
             $attr .= ' ' . $name . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
         }
         return "<img {$attr} src=\"data:image/png;base64,{$content}\"/>";
     });
     return $content;
 }
Ejemplo n.º 3
0
 protected function generatePage()
 {
     $content = parent::generatePage();
     //Embed images
     // We do it after generation so we can catch the images that were in html already
     $content = (new EmbedImages($this->params['tree']))->embed($content, $this->file, function ($src, array $attributes, Raw $file) {
         $filename = basename($file->getPath());
         //Add the attachment for later upload
         $this->attachments[$filename] = ['filename' => $filename, 'file' => $file];
         return $this->createImageTag($filename, $attributes);
     });
     $intro = '';
     if (array_key_exists('confluence', $this->params) && array_key_exists('header', $this->params['confluence']) && !empty($this->params['confluence']['header'])) {
         $intro = '<ac:structured-macro ac:name="info"><ac:rich-text-body>' . $this->params['confluence']['header'] . '</ac:rich-text-body></ac:structured-macro>';
     }
     return $intro . $content;
 }