Move to addon

This commit is contained in:
Michael 2024-01-14 19:18:41 +00:00
parent a2f4b4cd3d
commit a12fbf7ff3
2 changed files with 7 additions and 16 deletions

View File

@ -21,13 +21,12 @@
namespace Friendica\Util; namespace Friendica\Util;
use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Object\Image; use Friendica\Object\Image;
use thiagoalessio\TesseractOCR\TesseractOCR;
/** /**
* Image utilities * Image utilities
@ -262,15 +261,12 @@ class Images
if ($image->isValid()) { if ($image->isValid()) {
$data['blurhash'] = $image->getBlurHash(); $data['blurhash'] = $image->getBlurHash();
if ($ocr && DI::config()->get('system', 'tesseract_ocr')) { if ($ocr) {
$ocr = new TesseractOCR(); $media = ['img_str' => $img_str];
try { Hook::callAll('ocr-detection', $media);
$ocr->tempDir(System::getTempPath()); if (!empty($media['description'])) {
$ocr->imageData($img_str, strlen($img_str)); $data['description'] = $media['description'];
$data['description'] = $ocr->run(); }
} catch (\Throwable $th) {
Logger::info('Error calling TesseractOCR', ['message' => $th->getMessage()]);
}
} }
} }

View File

@ -441,11 +441,6 @@ return [
// Don't show smilies. // Don't show smilies.
'no_smilies' => false, '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) // optimize_all_tables (Boolean)
// Optimizes all tables instead of only tables like workerqueue or the cache // Optimizes all tables instead of only tables like workerqueue or the cache
'optimize_all_tables' => false, 'optimize_all_tables' => false,