-upload_max_filesize = 8G
-post_max_size = 8G
+upload_max_filesize = 100G
+post_max_size = 100G
error_log = /proc/self/fd/2
log_errors = 1
memory_limit = 12G
$this->fluidbookSettings->set($key, $value);
}
+ public function pushSetting($key, $value)
+ {
+ $v = $this->fluidbookSettings->get($key, []);
+ $v[] = $value;
+ $this->fluidbookSettings->set($key, $v);
+ }
+
/**
* @param $key
}
+ protected function _extranetToToolboxPath($path)
+ {
+ if (str_starts_with($path, '/application/fluidbook/books/working/')) {
+ return str_replace('/application/fluidbook/books/working/', '/application/protected/fluidbookpublication/working/', $path);
+ }
+ return $path;
+ }
+
protected function _wdirOrAbsolute($path)
{
+ $path = $this->_extranetToToolboxPath($path);
$e = explode('#', $path);
if (file_exists($e[0])) {
return $path;
protected function _font($f)
{
- if(!$f){
- $f='OpenSans';
+ if (!$f) {
+ $f = 'OpenSans';
}
$font = FluidbookFont::getAvailableFonts()[$f];
if ($font['font_kit']) {
$default = ['page_name' => ''];
$this->config->tagcommander_default_vars = array_merge($default, $this->parseVariables($this->fluidbookSettings->tagcommander_default_vars));
- $this->config->tagcommander_default_vars['env_work'] = $this->fluidbookSettings->tagcommander_prod ? 'prod' : 'pre-prod';
+ $this->config->set('tagcommander_default_vars.env_work', $this->fluidbookSettings->tagcommander_prod ? 'prod' : 'pre-prod');
$scriptNames = explode(',', $this->config->tagcommander_scriptname);
$this->fluidbookSettings->googleAnalyticsCustom .= '<script>window.tc_vars=' . json_encode($this->config->tagcommander_default_vars) . ';</script><script src="//cdn.tagcommander.com/' . $id . '/' . $scriptNames[0] . '"></script>';
$uploadID = Str::random();
$file = request()->file('file');
+ if (null === $file) {
+ abort(500);
+ }
$document = new FluidbookDocument();
$document->file = $file->getClientOriginalName();
$document->file_data = ["fileName" => $file->getClientOriginalName(), "fileSize" => $file->getSize(), "modificationDate" => $file->getMTime(), "creationDate" => $file->getCTime()];
protected $path = "";
+ protected $log = '';
+
public function __construct($document, $page, $format = 'jpg', $resolution = 150, $quality = 85, $withText = true, $withGraphics = true, $version = 'html', $forceCheck = false, $forceProcess = false)
{
$this->onQueue('fluidbookprocess');
public function handle()
{
$this->finish = false;
- echo $this->document->getFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->version, $this->forceCheck, $this->forceProcess) . "\n";
+ try {
+ echo $this->document->getFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->version, $this->forceCheck, $this->forceProcess) . "\n";
+ } catch (\Exception $e) {
+ $this->log = $e->getMessage();
+ }
$this->finish = true;
}
/**
* @return boolean
*/
- public function isDone()
+ public function isDone($forceCheck = false)
{
- return $this->finish || $this->isOK();
+ return $this->finish || $this->isOK($forceCheck);
}
- public function isOK()
+ public function isOK($forceCheck = false)
{
- return $this->document->hasFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->version, $this->forceCheck);
+ return $this->document->hasFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->version, $this->forceCheck || $forceCheck);
}
public function isError()
{
return $this->path;
}
+
+ public function getLog(){
+ return $this->log;
+ }
}
use Cubist\Util\Gzip;
use Cubist\Util\Math;
use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Log;
// __('!!Paramètres des fluidbooks')
class FluidbookDocument extends ToolboxModel
public function _getPath($page, $format = 'jpg', $resolution = 150, $quality = 85, $withText = true, $withGraphics = true, $version = 'html')
{
+ $this->_normalize($format, $resolution, $quality, $withText, $withGraphics, $version);
$cacheKey = $this->fileCacheKey($page, $format, $resolution, $quality, $withText, $withGraphics, $version);
if (Cache::has($cacheKey)) {
return Cache::get($cacheKey);
}
- $this->_normalize($format, $resolution, $quality, $withText, $withGraphics, $version);
-
$dir = $this->path($version) . '/';
if ($format === 'svg') {
$file .= '-' . $resolution;
}
$file .= '.svg';
- } else if ($format === 'png' || $format === 'jpg') {
+ } else {
$q = ($format === 'jpg' && $quality != 85) ? '-' . $quality : '';
$prefix = $withText ? 't' : 'h';
if ($resolution === 'thumb') {
public function getFile($page, $format = 'jpg', $resolution = 150, $quality = 85, $withText = true, $withGraphics = true, $version = 'html', $forceCheck = false, $forceProcess = false)
{
$this->_normalize($format, $resolution, $quality, $withText, $withGraphics, $version);
+ if ($page == 1 && $version === 'mf') {
+ Log::debug('get file ' . $page . ', ' . $format . ', ' . $resolution . ', ' . $quality . ', ' . $withText . ', ' . $withGraphics . ', ' . $version . ', ' . $forceCheck . ', ' . $forceProcess);
+ }
if ($forceProcess) {
$this->removeFile($page, $format, $resolution, $withText, $withGraphics, $version);
}
public function generate()
{
- $res = '<div class="svg-sprite" style="height: 0;width: 0;position: absolute;" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" style="display: none;">';
+ $res = '{{--' . "\n\n" . 'Downloaded from ' . backpack_url('tool-sprite/' . $this->id . '/download') . "\n" . 'Edit here : ' . backpack_url('tool-sprite/' . $this->id . '/edit') . "\n\n" . '--}}';
+ $res .= '<div class="svg-sprite" style="height: 0;width: 0;position: absolute;" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" style="display: none;">';
foreach ($this->icons as $icon) {
if (preg_match('/<svg(.*)viewBox="([^\"]+)"([^>]*)?>(.*)<\/svg>/ms', $icon['svgcode'], $matches)) {
$svg = $matches[4];