mirror of
https://github.com/friendica/friendica
synced 2025-04-26 23:50:11 +00:00
Use OCR to fetch text in images
This commit is contained in:
parent
16b12e1545
commit
3a60229e5c
5 changed files with 93 additions and 7 deletions
|
@ -208,13 +208,17 @@ class Media
|
|||
$filetype = !empty($media['mimetype']) ? strtolower(current(explode('/', $media['mimetype']))) : '';
|
||||
|
||||
if (($media['type'] == self::IMAGE) || ($filetype == 'image')) {
|
||||
$imagedata = Images::getInfoFromURLCached($media['url']);
|
||||
$imagedata = Images::getInfoFromURLCached($media['url'], empty($media['description']));
|
||||
if ($imagedata) {
|
||||
$media['mimetype'] = $imagedata['mime'];
|
||||
$media['size'] = $imagedata['size'];
|
||||
$media['width'] = $imagedata[0];
|
||||
$media['height'] = $imagedata[1];
|
||||
$media['blurhash'] = $imagedata['blurhash'] ?? null;
|
||||
if (!empty($imagedata['description']) && empty($media['description'])) {
|
||||
$media['description'] = $imagedata['description'];
|
||||
Logger::debug('Detected text for image', $media);
|
||||
}
|
||||
} else {
|
||||
Logger::notice('No image data', ['media' => $media]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue