mirror of
https://github.com/friendica/friendica
synced 2024-11-19 03:03:41 +00:00
Fix jpeg ending
This commit is contained in:
parent
c0db555757
commit
777919e679
3 changed files with 14 additions and 20 deletions
|
@ -177,14 +177,14 @@ function prepare_photo_data($type, $scale, $photo_id, $uid)
|
||||||
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
|
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
|
||||||
$data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'],
|
$data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'],
|
||||||
"scale" => $k,
|
"scale" => $k,
|
||||||
"href" => DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . Images::getExtensionByMimeType($data['photo']['type'])];
|
"href" => DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . Images::getExtensionByMimeType($data['photo']['type'])];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$data['photo']['link'] = [];
|
$data['photo']['link'] = [];
|
||||||
// when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0
|
// when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0
|
||||||
$i = 0;
|
$i = 0;
|
||||||
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
|
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
|
||||||
$data['photo']['link'][$i] = DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . Images::getExtensionByMimeType($data['photo']['type']);
|
$data['photo']['link'][$i] = DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . Images::getExtensionByMimeType($data['photo']['type']);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ function api_fr_photos_list($type)
|
||||||
$photo['album'] = $rr['album'];
|
$photo['album'] = $rr['album'];
|
||||||
$photo['filename'] = $rr['filename'];
|
$photo['filename'] = $rr['filename'];
|
||||||
$photo['type'] = $rr['type'];
|
$photo['type'] = $rr['type'];
|
||||||
$thumb = DI::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . Images::getExtensionByMimeType($rr['type']);
|
$thumb = DI::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . Images::getExtensionByMimeType($rr['type']);
|
||||||
$photo['created'] = $rr['created'];
|
$photo['created'] = $rr['created'];
|
||||||
$photo['edited'] = $rr['edited'];
|
$photo['edited'] = $rr['edited'];
|
||||||
$photo['desc'] = $rr['desc'];
|
$photo['desc'] = $rr['desc'];
|
||||||
|
|
|
@ -850,19 +850,16 @@ class User
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$updated = '';
|
$updated = '';
|
||||||
$imagetype = IMAGETYPE_JPEG;
|
$mimetype = '';
|
||||||
|
|
||||||
$photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => $scale, 'uid' => $user['uid'], 'profile' => true]);
|
$photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => $scale, 'uid' => $user['uid'], 'profile' => true]);
|
||||||
if (!empty($photo)) {
|
if (!empty($photo)) {
|
||||||
$updated = max($photo['created'], $photo['edited'], $photo['updated']);
|
$updated = max($photo['created'], $photo['edited'], $photo['updated']);
|
||||||
|
$mimetype = $photo['type'];
|
||||||
if (in_array($photo['type'], ['image/png', 'image/gif'])) {
|
|
||||||
$imagetype = IMAGETYPE_PNG;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url . $user['nickname'] . image_type_to_extension($imagetype) . ($updated ? '?ts=' . strtotime($updated) : '');
|
return $url . $user['nickname'] . Images::getExtensionByMimeType($mimetype) . ($updated ? '?ts=' . strtotime($updated) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -880,22 +877,19 @@ class User
|
||||||
|
|
||||||
$url = DI::baseUrl() . '/photo/banner/';
|
$url = DI::baseUrl() . '/photo/banner/';
|
||||||
|
|
||||||
$updated = '';
|
$updated = '';
|
||||||
$imagetype = IMAGETYPE_JPEG;
|
$mimetype = '';
|
||||||
|
|
||||||
$photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => 3, 'uid' => $user['uid'], 'photo-type' => Photo::USER_BANNER]);
|
$photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => 3, 'uid' => $user['uid'], 'photo-type' => Photo::USER_BANNER]);
|
||||||
if (!empty($photo)) {
|
if (!empty($photo)) {
|
||||||
$updated = max($photo['created'], $photo['edited'], $photo['updated']);
|
$updated = max($photo['created'], $photo['edited'], $photo['updated']);
|
||||||
|
$mimetype = $photo['type'];
|
||||||
if (in_array($photo['type'], ['image/png', 'image/gif'])) {
|
|
||||||
$imagetype = IMAGETYPE_PNG;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Only for the RC phase: Don't return an image link for the default picture
|
// Only for the RC phase: Don't return an image link for the default picture
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url . $user['nickname'] . image_type_to_extension($imagetype) . ($updated ? '?ts=' . strtotime($updated) : '');
|
return $url . $user['nickname'] . Images::getExtensionByMimeType($mimetype) . ($updated ? '?ts=' . strtotime($updated) : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Images
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$imagetype = IMAGETYPE_JPC;
|
$imagetype = IMAGETYPE_JPEG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue