]> git.mxchange.org Git - friendica.git/commitdiff
Move to addon
authorMichael <heluecht@pirati.ca>
Sun, 14 Jan 2024 19:18:41 +0000 (19:18 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 14 Jan 2024 19:18:41 +0000 (19:18 +0000)
src/Util/Images.php
static/defaults.config.php

index 0d64601f1d5b0ecd39c07cc63012dca3bf3bb162..e5b8afbb545cb24fda69f574468d07ffb75dda80 100644 (file)
 
 namespace Friendica\Util;
 
+use Friendica\Core\Hook;
 use Friendica\Core\Logger;
-use Friendica\Core\System;
 use Friendica\DI;
 use Friendica\Model\Photo;
 use Friendica\Network\HTTPClient\Client\HttpClientAccept;
 use Friendica\Object\Image;
-use thiagoalessio\TesseractOCR\TesseractOCR;
 
 /**
  * Image utilities
@@ -262,15 +261,12 @@ class Images
                if ($image->isValid()) {
                        $data['blurhash'] = $image->getBlurHash();
                        
-                       if ($ocr && DI::config()->get('system', 'tesseract_ocr')) {
-                               $ocr = new TesseractOCR();
-                               try {
-                                       $ocr->tempDir(System::getTempPath());
-                                       $ocr->imageData($img_str, strlen($img_str));
-                                       $data['description'] = $ocr->run();
-                               } catch (\Throwable $th) {
-                                       Logger::info('Error calling TesseractOCR', ['message' => $th->getMessage()]);
-                               }                       
+                       if ($ocr) {
+                               $media = ['img_str' => $img_str];
+                               Hook::callAll('ocr-detection', $media);
+                               if (!empty($media['description'])) {
+                                       $data['description'] = $media['description'];
+                               }
                        }
                }
 
index 47501fe91f3b91cfa747d0ce9e192afe9048f4fd..819b0ad85fb45d357d1fd9c2978820d1a0155f41 100644 (file)
@@ -441,11 +441,6 @@ return [
                // Don't show smilies.
                'no_smilies' => false,
 
-               // tesseract_ocr (Boolean)
-               // Use Tesseract OCR to use OCR to fetch text from images.
-               // The Tesseract OCR command line tool needs to be installed separately on the system.
-               'tesseract_ocr' => false,
-
                // optimize_all_tables (Boolean)
                // Optimizes all tables instead of only tables like workerqueue or the cache
                'optimize_all_tables' => false,