Socialmetrica/Socialmetrica.package/NitterUser.class/instance/avatarPicture.st

10 lines
477 B
Smalltalk
Raw Normal View History

accessing
avatarPicture
| response tempImage |
response := ZnClient new url: (self profileImageUrl); get; response.
response contentType = ZnMimeType imageJpeg
2022-05-14 22:45:58 +00:00
ifTrue: [ tempImage := (PluginBasedJPEGReadWriter gtFromBuffer: response contents) asElement ].
response contentType = ZnMimeType imagePng
2022-05-14 22:45:58 +00:00
ifTrue: [ tempImage := (PNGReadWriter gtFromBuffer: response contents) asElement ].
tempImage on: Error do: [ ^ GtABContact new avatar ].
^ tempImage value asElement .