<project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="odl.paris.cubedesigners.com" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true" showAutoUploadSettingsWarning="false">
<serverData>
- <paths name="apps.fluidbook.com">
+ <paths name="batman.cubedesigners.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
+ <paths name="ccv-montpellier.fr">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
+ <paths name="dev.extranet.cubedesigners.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="dev.fluidbook.com">
<serverdata>
<mappings>
</mappings>
</serverdata>
</paths>
+ <paths name="dev.pm-instrumentation.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="dev.rbcmobilier.com">
<serverdata>
<mappings>
</mappings>
</serverdata>
</paths>
+ <paths name="odl.cube">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="odl.paris.cubedesigners.com">
<serverdata>
<mappings>
- <mapping deploy="/www/vendor/fluidbook/tools" local="$PROJECT_DIR$" web="/" />
+ <mapping deploy="/vendor/fluidbook/tools" local="$PROJECT_DIR$" web="/" />
</mappings>
<excludedPaths>
<excludedPath local="true" path="$PROJECT_DIR$/vendor" />
</mappings>
</serverdata>
</paths>
+ <paths name="preview.cubedesigners.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="pro.cubjeans.com">
<serverdata>
<mappings>
</mappings>
</serverdata>
</paths>
- <paths name="vm.hf-customercare.com">
+ <paths name="stats3.fluidbook.com">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
- <paths name="wheel02.hf-customercare.com">
+ <paths name="toolbox.fluidbook.com">
<serverdata>
<mappings>
<mapping local="$PROJECT_DIR$" web="/" />
</mappings>
</serverdata>
</paths>
+ <paths name="www.hf-customercare.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="www.kadreo.com">
<serverdata>
<mappings>
</mappings>
</serverdata>
</paths>
+ <paths name="www.pm-instrumentation.com">
+ <serverdata>
+ <mappings>
+ <mapping local="$PROJECT_DIR$" web="/" />
+ </mappings>
+ </serverdata>
+ </paths>
<paths name="www.preventicom.com">
<serverdata>
<mappings>
use JsonException;
use stdClass;
-class Compiler implements ShouldQueue, ShouldBeUnique {
+class Compiler implements ShouldQueue, ShouldBeUnique
+{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Links;
*/
protected $resolutions = [150, 300];
- public function addSource($document, $start = 1, $pages = null) {
+ public function addSource($document, $start = 1, $pages = null)
+ {
$source = new Source(new Document($document), $start, $pages);
$this->sources[] = $source;
foreach ($source->getRange() as $sourcePage) {
}
}
- public function getVirtualDirectory() {
+ public function getVirtualDirectory()
+ {
return $this->vdir;
}
*
* @return void
*/
- public function handle() {
+ public function handle()
+ {
$sync = ($this->job instanceof SyncJob);
if ($sync) {
PHP::neverStop(false);
stop_measure('Process Fluidbook');
}
- public function processPages($sync = false) {
+ public function processPages($sync = false)
+ {
start_measure('Process Pages');
foreach ($this->sources as $source) {
$source->getDocument()->processPages($this->getProcessFiles(), $source->getRange(), $sync);
stop_measure('Process Pages');
}
- public function getTexts() {
+ public function getTexts()
+ {
start_measure('Process texts');
foreach ($this->sources as $source) {
$source->getDocument()->processTexts();
start_measure('Process texts');
}
+
/**
* @return ProcessFile[]
*/
- public function getProcessFiles() {
+ public function getProcessFiles()
+ {
$res = [
'thumb' => new ProcessFile('jpg', 'thumb'),
'text' => new ProcessFile('svg', 150, false, true),
* @return ProcessFile
* @throws Exception
*/
- public function getProcessFile($name, $page = null) {
+ public function getProcessFile($name, $page = null)
+ {
$files = $this->getProcessFiles();
if (isset($files[$name])) {
$res = $files[$name];
* @return SourcePage
* @throws Exception
*/
- public function getSourceOfPage($page) {
+ public function getSourceOfPage($page)
+ {
if (isset($this->pages[$page - 1])) {
return $this->pages[$page - 1];
}
/**
* @throws JsonException
*/
- protected function compileFluidbook() {
+ protected function compileFluidbook()
+ {
start_measure('Compile fluidbook');
if ($this->wdir === '') {
stop_measure('Compile fluidbook');
}
- public function prepareStub() {
+ public function prepareStub()
+ {
if ($this->stub !== '') {
$this->vdir->copyDirectory($this->stub, '/');
}
}
- public function compileContents() {
+ public function compileContents()
+ {
for ($i = 1; $i <= $this->getPageCount(); $i++) {
foreach ($this->resolutions as $resolution) {
}
}
- public function getPageCount() {
+ public function getPagePDFSource($page)
+ {
+ return $this->getProcessFile('back300', $page)->getSplittedPDFPage();
+ }
+
+ public function getPageCount()
+ {
$res = 0;
foreach ($this->sources as $source) {
$res += $source->getPages();
/**
* @throws \JsonException
*/
- public function compileSearch() {
+ public function compileSearch()
+ {
$index = new SearchIndex();
foreach ($this->pages as $i => $page) {
/**
* @throws JsonException
*/
- public function compileConfig() {
+ public function compileConfig()
+ {
$settings = mb_substr(file_get_contents($this->stub . '/data/datas.js'), 13, -2);
$this->config = json_decode($settings, false, 512, JSON_THROW_ON_ERROR);
$this->config->maxResolution = 300;
$this->vdir->file_put_contents('data/datas.js', $c);
}
- protected function compileDimensions() {
+ protected function compileDimensions()
+ {
$firstPageDoc = $this->getSourceOfPage(1)->getSource()->getDocument();
$width = round($firstPageDoc->getWidth(), 8);
}
}
- protected function compilePageNumbers() {
+ protected function compilePageNumbers()
+ {
$this->config->numerotation = [];
foreach ($this->sources as $source) {
}
}
- protected function compileChapters() {
+ protected function compileChapters()
+ {
$this->config->chaptersPagesNumber = 'physical';
$this->config->chapters = [];
foreach ($this->sources as $source) {
}
}
- public function getBookSurface() {
+ public function getBookSurface()
+ {
return $this->getWidth() * $this->getHeight();
}
- public function getWidth() {
+ public function getWidth()
+ {
return $this->getSourceOfPage(1)->getSource()->getDocument()->getWidth();
}
- public function getHeight() {
+ public function getHeight()
+ {
return $this->getSourceOfPage(1)->getSource()->getDocument()->getHeight();
}
- public function addVideoJs() {
+ public function addVideoJs()
+ {
$this->addLess('videojs/videojs');
}
- public function addSlideshowLibrary($inline = true) {
+ public function addSlideshowLibrary($inline = true)
+ {
$l = ($inline ? $this->config->inlineSlideshowLibrary : $this->config->popupSlideshowLibrary);
$this->addLess('slideshow/' . $l);
}
use Cubist\Util\Files\Files;
use Cubist\Util\Graphics\PDF;
use Cubist\Util\Text;
+use Fluidbook\Tools\Compiler\Compiler;
class ZoomLink extends NormalLink
{
];
}
+ /**
+ * @param $attributes
+ * @param $compiler Compiler
+ * @param $cachedir
+ * @param $save
+ * @return void
+ */
public static function generateImage($attributes, $compiler, $cachedir, $save)
{
$y = $attributes['y'];
$w = $attributes['width'];
$h = $attributes['height'];
- $bookwidth = round($compiler->width);
+ $bookwidth = round($compiler->config->width);
//error_log("--- Book Width: $bookwidth ---");
if (!isset($attributes['pdf']) || !$attributes['pdf']) {
- $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page']);
- $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf';
+ $pdfpath = $compiler->getPagePDFSource($attributes['page']);
$extractPage = 1;
} else {
$pdfpath = $attributes['pdf'];
$extractPage = $attributes['page'];
}
+ $cache=storage_path('fluidbook/cache/zoomarea');
+
$left = Files::tempnam();
$leftfile = PDF::extractArea($pdfpath,
$extractPage,
array('x' => $x, 'y' => $y, 'width' => $w, 'height' => $h),
- $left, $extractOptions, storage_path('cache/' . $cachedir . '/' . $compiler->book_id . '/'));
+ $left, $extractOptions,$cache);
if (($x + $w) > $bookwidth) {
if (!isset($attributes['pdf']) || !$attributes['pdf']) {
- $p = wsDAOBook::getDocumentPage($compiler->book_id, $attributes['page'] + 1);
- $pdfpath = wsDocument::getDir($p['document_id']) . '/pdf/p' . $p['document_page'] . '.pdf';
+
+ $pdfpath = $compiler->getPagePDFSource($attributes['page'] + 1);
$extractPage = 1;
} else {
$pdfpath = $attributes['pdf'];
$rightfile = PDF::extractArea($pdfpath,
$extractPage,
array('x' => 0, 'y' => $y, 'width' => $diff, 'height' => $h),
- $right, $extractOptions, storage_path('cache/' . $cachedir . '/' . $compiler->book_id . '/'));
+ $right, $extractOptions,$cache);
if (!file_exists($rightfile)) {
die('Error generating right part ' . $rightfile);
if (isset($attributes['border']) && $attributes['border'] > 0) {
$tmp = Files::tempnam() . '.jpg';
Imagemagick::addBorder($both, $tmp, $attributes['border'], $attributes['borderColor']);
- $compiler->vdir->addTemp($both);
+ $compiler->getVirtualDirectory()->addTemp($both);
$both = $tmp;
}
$files_to_delete = ['left', 'leftfile', 'right', 'rightfile', 'both'];
foreach ($files_to_delete as $file) {
if (isset($$file)) {
- $compiler->vdir->addTemp($$file);
+ $compiler->getVirtualDirectory()->addTemp($$file);
}
}
}