public function getVirtualDirectory(): VirtualDirectory;
public function getWorkingDir(): string;
-
+
public function setWorkingDir(string $wdir);
+
+ public function working_path($path = ''): string;
}
$this->wdir = $wdir;
}
- public function working_path($path = '')
+ public function working_path($path = ''):string
{
$res = $this->getWorkingDir();
return $path ? $res . '/' . $path : $res;
$dir = $fdir;
$d = array('fdir' => $fdir, 'dir' => $dir);
- $file = $this->compiler->wdir . '/' . $this->alternative;
- $this->compiler->getVirtualDirectory()->copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative);
+ $this->compiler->getVirtualDirectory()->copy( $this->compiler->working_path($this->alternative), $d['dir'] . '/' . $this->alternative);
$this->_config = $this->getConfigHTML($d['dir'], $this->alternative);
$this->copyExternalFile($d['dir'] . '/' . $this->alternative);
}
namespace Fluidbook\Tools\Links;
+use Cubist\Util\Graphics\Image;
+
class HTMLMultimediaPopupImage extends NormalLink
{
public $clickToClose = 0;
public function getAdditionnalContent()
{
$res = parent::getAdditionnalContent();
- $dim = CubeIT_Image::getimagesize($this->wdir . '/' . $this->alternative);
+ $dim = Image::getimagesize($this->compiler->working_path($this->alternative));
$markup = '<div class="multimediaContainer" data-click-to-close="' . $this->clickToClose . '"><img data-width="' . $dim[0] . '" data-height="' . $dim[1] . '" src="' . Link::getUniversalLocation($this->alternative) . '" width="' . $dim[0] . '" height="' . $dim[1] . '" class="multimedia" /></div>';
$read = '';
foreach ($slides as $slide) {
- $image_path_relative = str_replace($this->compiler->wdir, '', $slide['path']);
+ $image_path_relative = str_replace($this->compiler->getWorkingDir() . "/", '', $slide['path']);
$image_info = Image::getimagesize($slide['path']);
$image_info_json = ($image_info) ? json_encode(['width' => $image_info[0], 'height' => $image_info[1], 'ratio' => round($image_info[0] / $image_info[1], 4)]) : '';
use Cubist\Util\Files\Files;
use Cubist\Util\Url;
+use Fluidbook\Tools\Compiler\CompilerInterface;
use Illuminate\Support\Facades\Cache;
class VideoLink extends Link
return $res;
}
+ /**
+ * @param $data
+ * @param $w
+ * @param $h
+ * @param $compiler CompilerInterface
+ * @return array
+ */
public static function getVideoAttributes($data, $w = null, $h = null, $compiler = null)
{
$attr['name'] = VideoPopupLink::getBasename($data->to);
$attr['sound'] = ($data->video_sound_on ? '1' : '0');
$attr['hidelinksonplay'] = $data->hidelinksonplay;
$attr['link-id'] = $data->uid;
- $attr['backgroundcolor'] = isset($data->backgroundColor) ? $data->backgroundColor : '#000000';
+ $attr['backgroundcolor'] = $data->backgroundColor ?? '#000000';
if (!is_null($w) && !is_null($h)) {
$attr['width'] = $w;
$attr['height'] = $h;
} else if (!is_null($compiler) && Url::isLocal($data->to)) {
- $path = file_exists($data->to) ? $data->to : $compiler->wdir . '/' . $data->to;
+ $path = file_exists($data->to) ? $data->to : $compiler->working_path($data->to);
$dim = Cache::remember('videosize_' . Files::hashFileAttributes($path), 86400, function () use ($path) {
$e = explode(',', `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 $path`);