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;
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,14 +261,11 @@ 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'];
}
}
}

View 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,