From: Michael Date: Sun, 14 Jan 2024 19:18:41 +0000 (+0000) Subject: Move to addon X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a12fbf7ff337b3b1aa57a06d266364a620ab14f3;p=friendica.git Move to addon --- diff --git a/src/Util/Images.php b/src/Util/Images.php index 0d64601f1d..e5b8afbb54 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -21,13 +21,12 @@ 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']; + } } } diff --git a/static/defaults.config.php b/static/defaults.config.php index 47501fe91f..819b0ad85f 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -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,