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

10 lines
477 B
Smalltalk

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