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
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'];
+ }
}
}
// 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,