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

10 lines
455 B
Smalltalk
Raw Normal View History

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