mirror of
https://github.com/friendica/friendica
synced 2025-04-27 01:50:11 +00:00
AVoid throwing an error / store the size of pages
This commit is contained in:
parent
4dd64b1a5d
commit
7fdf244bae
3 changed files with 8 additions and 4 deletions
|
@ -193,7 +193,7 @@ class Media
|
|||
$media['mimetype'] = $curlResult->getContentType() ?? '';
|
||||
}
|
||||
if (empty($media['size'])) {
|
||||
$media['size'] = (int)($curlResult->getHeader('Content-Length')[0] ?? 0);
|
||||
$media['size'] = (int)($curlResult->getHeader('Content-Length')[0] ?? strlen($curlResult->getBodyString() ?? ''));
|
||||
}
|
||||
} else {
|
||||
Logger::notice('Could not fetch head', ['media' => $media]);
|
||||
|
@ -363,6 +363,7 @@ class Media
|
|||
private static function addPage(array $media): array
|
||||
{
|
||||
$data = ParseUrl::getSiteinfoCached($media['url']);
|
||||
$media['size'] = $data['size'] ?? null;
|
||||
$media['preview'] = $data['images'][0]['src'] ?? null;
|
||||
$media['preview-height'] = $data['images'][0]['height'] ?? null;
|
||||
$media['preview-width'] = $data['images'][0]['width'] ?? null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue