mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +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
|
@ -35,43 +35,7 @@ final class Wall extends VKAPIRequestHandler
|
||||||
"date" => $attachment->getPublicationTime()->timestamp(),
|
"date" => $attachment->getPublicationTime()->timestamp(),
|
||||||
"id" => $attachment->getVirtualId(),
|
"id" => $attachment->getVirtualId(),
|
||||||
"owner_id" => $attachment->getOwner()->getId(),
|
"owner_id" => $attachment->getOwner()->getId(),
|
||||||
"sizes" => array(
|
"sizes" => array_values($attachment->getVkApiSizes()),
|
||||||
[
|
|
||||||
"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" => "",
|
"text" => "",
|
||||||
"has_tags" => false
|
"has_tags" => false
|
||||||
]
|
]
|
||||||
|
|
|
@ -165,8 +165,11 @@ class Photo extends Media
|
||||||
foreach($manifest->Size as $size)
|
foreach($manifest->Size as $size)
|
||||||
$mappings[(string) $size["id"]] = (string) $size["vkId"];
|
$mappings[(string) $size["id"]] = (string) $size["vkId"];
|
||||||
|
|
||||||
foreach($sizes as $id => $meta)
|
foreach($sizes as $id => $meta) {
|
||||||
$res[$mappings[$id] ?? $id] = $meta;
|
$type = $mappings[$id] ?? $id;
|
||||||
|
$meta->type = $type;
|
||||||
|
$res[$type] = $meta;
|
||||||
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue