25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Add 'width' and 'height' to avatar info

This commit is contained in:
Evgeniy Khramtsov 2017-09-18 09:33:57 +03:00
parent f435d0a103
commit 5bf64381cb

View File

@ -267,7 +267,16 @@ publish_avatar(#iq{from = JID} = IQ, Meta, MimeType, Data, ItemID) ->
LBJID, LServer, ?NS_AVATAR_DATA,
JID, ItemID, [Payload]) of
{result, _} ->
{W, H} = case eimp:identify(Data) of
{ok, ImgInfo} ->
{proplists:get_value(width, ImgInfo),
proplists:get_value(height, ImgInfo)};
_ ->
{undefined, undefined}
end,
I = #avatar_info{id = ItemID,
width = W,
height = H,
type = MimeType,
bytes = size(Data)},
Meta1 = Meta#avatar_meta{info = [I|Info]},