Align proxy sizes to photo preview sizes

- PIXEL_SMALL goes from 300 to 320
- PIXEL_MEDIUM goes from 600 to 640
- Use Proxy pixel constants where we used hard-coded pixel values
This commit is contained in:
Hypolite Petovan 2023-10-14 15:29:03 -04:00
parent e0d4646c18
commit 938b2bae23
5 changed files with 24 additions and 23 deletions

View file

@ -312,16 +312,16 @@ function photos_post(App $a)
Photo::update(['height' => $height, 'width' => $width], ['resource-id' => $resource_id, 'uid' => $page_owner_uid, 'scale' => 0], $image);
if ($width > 640 || $height > 640) {
$image->scaleDown(640);
if ($width > \Friendica\Util\Proxy::PIXEL_MEDIUM || $height > \Friendica\Util\Proxy::PIXEL_MEDIUM) {
$image->scaleDown(\Friendica\Util\Proxy::PIXEL_MEDIUM);
$width = $image->getWidth();
$height = $image->getHeight();
Photo::update(['height' => $height, 'width' => $width], ['resource-id' => $resource_id, 'uid' => $page_owner_uid, 'scale' => 1], $image);
}
if ($width > 320 || $height > 320) {
$image->scaleDown(320);
if ($width > \Friendica\Util\Proxy::PIXEL_SMALL || $height > \Friendica\Util\Proxy::PIXEL_SMALL) {
$image->scaleDown(\Friendica\Util\Proxy::PIXEL_SMALL);
$width = $image->getWidth();
$height = $image->getHeight();