use Friendica\Core\StorageManager;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\Model\Storage\IStorage;
use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
public static function select(array $fields = [], array $conditions = [], array $params = [])
{
if (empty($fields)) {
- $selected = self::getFields();
+ $fields = self::getFields();
}
$r = DBA::select("photo", $fields, $conditions, $params);
*/
public static function getImageForPhoto(array $photo)
{
- $data = "";
if ($photo["backend-class"] == "") {
// legacy data storage in "data" column
$i = self::selectFirst(["data"], ["id" => $photo["id"]]);
$fields = self::getFields();
$values = array_fill(0, count($fields), "");
$photo = array_combine($fields, $values);
- $photo["backend-class"] = \Friendica\Model\Storage\SystemResource::class;
+ $photo["backend-class"] = Storage\SystemResource::class;
$photo["backend-ref"] = $filename;
$photo["type"] = $mimetype;
$photo["cacheable"] = false;
// if is an existing photo, reuse same backend
$data = "";
$backend_ref = "";
- $backend_class = "";
+ /** @var IStorage $backend_class */
if (DBA::isResult($existing_photo)) {
$backend_ref = (string)$existing_photo["backend-ref"];
$backend_class = (string)$existing_photo["backend-class"];
} else {
$backend_class = StorageManager::getBackend();
}
+
if ($backend_class === "") {
$data = $Image->asString();
} else {
$photos = self::select(["backend-class","backend-ref"], $conditions);
foreach($photos as $photo) {
+ /** @var IStorage $backend_class */
$backend_class = (string)$photo["backend-class"];
if ($backend_class !== "") {
$backend_class::delete($photo["backend-ref"]);
$photos = self::select(["backend-class","backend-ref"], $conditions);
foreach($photos as $photo) {
+ /** @var IStorage $backend_class */
$backend_class = (string)$photo["backend-class"];
if ($backend_class !== "") {
$fields["backend-ref"] = $backend_class::put($img->asString(), $photo["backend-ref"]);
}
/**
- * @param string $exifCoord coordinate
+ * @param array $exifCoord coordinate
* @param string $hemi hemi
* @return float
*/