Closed fcatae closed 7 years ago
Problem found: Picture returns text rather than binary (jpeg/png).
Ensure the picture is returned as a file:
string data = Util.GetUserPhotoString(user);
string[] components = data.Split(',');
int typePhotoStart = components[0].IndexOf(":") + 1;
int typePhotoEnd = components[0].IndexOf(";");
string encodedPhoto = components[1];
string typePhoto = components[0].Substring(typePhotoStart, typePhotoEnd - typePhotoStart);
byte[] binaryPhoto = Convert.FromBase64String(encodedPhoto);
var streamPhoto = new MemoryStream(binaryPhoto);
return new FileStreamResult(streamPhoto, typePhoto);
instead of just
Util.GetUserPhotoString(user);
Replace the client-side reference:
var url = '/users/photo/' + user;
$.ajax({
url: url,
type: "GET",
cache: true,
success: function (data) {
img = $('<img class="user">').attr('src', data);
$('#' + taskId + ' .folder-tasks .folder-footer').append(img);
}
});
to a simple:
var url = '/users/photo/' + user;
img = $('<img class="user">').attr('src', url);
$('#' + taskId + ' .folder-tasks .folder-footer').append(img);
@allantargino Finalmente resolvido o problema de carregamento de imagem. Depois faz um refresh e veja como ficou rapido. :)
Closing the issue. The pictures are very fast and stable.
This is the top 1 issue in Exceptions and HTTP 500. There are problems related to invalid names, lots of calls (200+), redis timeout, etc. Already implemented caching in Arda.Main, but we are still having problems.