]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7961 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Jan 2026 14:25:54 +0000 (15:25 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Jan 2026 14:25:54 +0000 (15:25 +0100)
app/Fluidbook/Compiler/Accessibility.php
app/Fluidbook/Compiler/Articles.php
app/Fluidbook/Link/Custom/WescoLink.php
app/Jobs/FluidbookImagesPreprocess.php
app/Models/Traits/PublicationSettings.php

index f5e1355d9a9cd404e66e30dc2ff9a8edd4f595f6..7bb0937e8589accbc4c48a80acf5bb0b0e286ce1 100644 (file)
@@ -132,7 +132,7 @@ trait Accessibility
 
     protected function _azureTTS($text, $locale, $gender, $voiceName, $output)
     {
-        if(!$text){
+        if (!$text) {
             return;
         }
         $api = new \Cubist\Azure\TTS\Api(env('AZURE_TTS_API_KEY'));
@@ -162,7 +162,7 @@ trait Accessibility
             $res = '';
         }
 
-        if (!$ocr) {
+        if (!$this->getFluidbook()->accessibility_ocr_assets || !$ocr) {
             return $res;
         }
 
index dbe813d8ecbe32ee58078345896162ae8ac2547e..96be09778fe4239c6331015835332e8af0aa6920 100644 (file)
@@ -241,7 +241,7 @@ trait Articles
             $this->vdir->copy($filepath, 'data/articles/' . $file);
             $legend = (string)$child;
             $caption = $legend ? '<figcaption>' . $legend . '</figcaption>' : '';
-            if (file_exists($filepath)) {
+            if (file_exists($filepath) && !is_dir($filepath)) {
                 $dim = getimagesize($filepath);
             } else {
                 $dim = [0 => 1024, 1 => 10];
index a5b965e76d20bc7523d4a7b9b6c1ecde42116f9c..b116891852dd54967852b4a8fac1a56bc604556f 100644 (file)
@@ -8,7 +8,7 @@ class WescoLink extends CustomLink
 {
     public static function _getURL($to,$type='',$default=null)
     {
-        return self::_getURLOfType($to,'wesco');
+        return static::_getURL($to, 'wesco');
     }
 
 }
index 1440577295cdc13f083c00442bef377182ccf475..60e71cfcdbf86892ce412482257cd24868f34fac 100644 (file)
@@ -85,13 +85,17 @@ class FluidbookImagesPreprocess extends Base
             $this->getFile($page, $settings->imageFormat, 'thumb');
         }
 
-        $this->jobs = array_merge($this->jobs, LinksData::ocrLinksImages($this->book, $this->_sync, false));
+        if($this->book->accessibility_ocr_assets) {
+            $this->jobs = array_merge($this->jobs, LinksData::ocrLinksImages($this->book, $this->_sync, false));
+        }
 
         while (true) {
             if ($this->_checkJobs()) {
-                dispatch(function () {
-                    LinksData::ocrLinksImages($this->book, true, true);
-                });
+                if($this->book->accessibility_ocr_assets) {
+                    dispatch(function () {
+                        LinksData::ocrLinksImages($this->book, true, true);
+                    });
+                }
                 return;
             }
             usleep(0.25 * 1000000);
index ed795592ff27fcfc7c3819c959087165bf89a3ad..fee4624467d3728509720466d5141b9b3a91c527 100644 (file)
@@ -1333,6 +1333,7 @@ trait PublicationSettings
     {
         $this->_addSettingField('section_accessibility', FormBigSection::class, $this->__('Accessibilité'));
         $this->_addSettingField('accessibility_menu', Checkbox::class, $this->__('Activer le menu d\'accessibilité'), ['default' => false]);
+        $this->_addSettingField('accessibility_ocr_assets',Checkbox::class, $this->__('Activer l\'OCR sur les liens image'), ['default'=>false]);
         $this->_addSettingField('accessible_contents', SelectFromArray::class, $this->__('Contenus alternatifs accessibles'), ['default' => 'disabled', 'options' => ['disabled' => __('Désactivés'), 'docling' => __('Contenus accessibles') . ' (docling)', 'excel' => __('Fichier excel ou liens "audiodescription"')]]);
         $this->_addSettingField('audiodescriptionTexts', FilesOrURL::class, $this->__('Contenus textuels'), [
             'accept' => self::$acceptXLSX,