mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Use Photo::getVkApiSizes in wall.get
Now wall.get will reflect accurate information about image sizes and their dimensions.
This commit is contained in:
parent
e6c14c2eeb
commit
622c9204b2
2 changed files with 9 additions and 42 deletions
|
@ -32,47 +32,11 @@ final class Wall extends VKAPIRequestHandler
|
|||
"type" => "photo",
|
||||
"photo" => [
|
||||
"album_id" => $attachment->getAlbum() ? $attachment->getAlbum()->getId() : null,
|
||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||
"id" => $attachment->getVirtualId(),
|
||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||
"id" => $attachment->getVirtualId(),
|
||||
"owner_id" => $attachment->getOwner()->getId(),
|
||||
"sizes" => array(
|
||||
[
|
||||
"height" => 2560,
|
||||
"url" => $attachment->getURLBySizeId("normal"),
|
||||
"type" => "m",
|
||||
"width" => 2560,
|
||||
],
|
||||
[
|
||||
"height" => 130,
|
||||
"url" => $attachment->getURLBySizeId("tiny"),
|
||||
"type" => "o",
|
||||
"width" => 130,
|
||||
],
|
||||
[
|
||||
"height" => 604,
|
||||
"url" => $attachment->getURLBySizeId("normal"),
|
||||
"type" => "p",
|
||||
"width" => 604,
|
||||
],
|
||||
[
|
||||
"height" => 807,
|
||||
"url" => $attachment->getURLBySizeId("large"),
|
||||
"type" => "q",
|
||||
"width" => 807,
|
||||
],
|
||||
[
|
||||
"height" => 1280,
|
||||
"url" => $attachment->getURLBySizeId("larger"),
|
||||
"type" => "r",
|
||||
"width" => 1280,
|
||||
],
|
||||
[
|
||||
"height" => 75, // Для временного компросима оставляю статическое число. Если каждый раз обращаться к файлу за количеством пикселов, то наступает пuпuська полная с производительностью, так что пока так
|
||||
"url" => $attachment->getURLBySizeId("miniscule"),
|
||||
"type" => "s",
|
||||
"width" => 75,
|
||||
]),
|
||||
"text" => "",
|
||||
"sizes" => array_values($attachment->getVkApiSizes()),
|
||||
"text" => "",
|
||||
"has_tags" => false
|
||||
]
|
||||
];
|
||||
|
|
|
@ -165,8 +165,11 @@ class Photo extends Media
|
|||
foreach($manifest->Size as $size)
|
||||
$mappings[(string) $size["id"]] = (string) $size["vkId"];
|
||||
|
||||
foreach($sizes as $id => $meta)
|
||||
$res[$mappings[$id] ?? $id] = $meta;
|
||||
foreach($sizes as $id => $meta) {
|
||||
$type = $mappings[$id] ?? $id;
|
||||
$meta->type = $type;
|
||||
$res[$type] = $meta;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue