$this->vdir = new VirtualDirectory($this->dir);
$this->vdir->copyDirectory(storage_path('fluidbook/out'), 'coeur');
- $frontDirectories=['css','fonts','images','js'];
+ $frontDirectories = ['css', 'fonts', 'images', 'js'];
foreach ($frontDirectories as $frontDirectory) {
$this->vdir->copyDirectory(public_path($frontDirectory), $frontDirectory);
}
*/
protected function _render($view) {
$html = $view->render();
+
+ // Parse html to find storage files that need to be copied in the final package
+ if (preg_match_all('/\\\\?\/storage\\\\?\/([^"?\)&]*)/', $html, $matches)) {
+ $files = array_unique($matches[1]);
+ foreach ($files as $match) {
+ $match = str_replace('\\/', '/', $match);
+ $f = public_path('storage/' . $match);
+ if (file_exists($f)) {
+ $this->vdir->copy($f, 'storage/' . $match);
+ } else {
+ echo 'Missing ' . $f . "\n";
+ }
+ }
+ }
+
+ //
$replace = [
'https://odl.paris.cubedesigners.com/front/' => './',
- 'https://odl.paris.cubedesigners.com/'=>'./',
- '/front/'=>'./',
+ 'https://cube.odile.space/front/' => './',
+ 'https://odl.paris.cubedesigners.com/' => './',
+ 'https://cube.odile.space/' => './',
+ '/front/' => './',
+ '\/storage' => '.\/storage',
+ '/storage/' => './storage/',
];
$html = str_replace(array_keys($replace), array_values($replace), $html);
+
return $html;
}