Use the raw data instead of an object

This commit is contained in:
Michael 2020-12-26 19:31:39 +00:00
parent 7f56e2e7a9
commit 997319a41f
2 changed files with 24 additions and 8 deletions

View file

@ -178,7 +178,7 @@ class Photo
/**
* Get Image object for given row id. null if row id does not exist
* Get Image data for given row id. null if row id does not exist
*
* @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref'
*
@ -186,7 +186,7 @@ class Photo
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function getImageForPhoto(array $photo)
public static function getImageDataForPhoto(array $photo)
{
$backendClass = DI::storageManager()->getByName($photo['backend-class'] ?? '');
if ($backendClass === null) {
@ -200,7 +200,21 @@ class Photo
$backendRef = $photo['backend-ref'] ?? '';
$data = $backendClass->get($backendRef);
}
return $data;
}
/**
* Get Image object for given row id. null if row id does not exist
*
* @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref'
*
* @return \Friendica\Object\Image
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function getImageForPhoto(array $photo)
{
$data = self::getImageDataForPhoto($photo);
if (empty($data)) {
return null;
}