GetProfilePicture
Var Name DataType Subtype
*************************************
StaffNo Text
Name ReturnType
**********************
BaseImage Text
Name DataType Subtype
*******************************************
ToFile Text
IStream InStream
Bytes DotNet System.Array.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Convert DotNet System.Convert.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
MemoryStream DotNet System.IO.MemoryStream.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
**********************************************************
GetProfilePicture(StaffNo : Text) BaseImage : Text
**********************************************************
"Employee Card".RESET;
"Employee Card".SETRANGE("Employee Card"."No.", StaffNo);
IF "Employee Card".FIND('-') THEN BEGIN
IF "Employee Card".Picture.HASVALUE THEN BEGIN
"Employee Card".CALCFIELDS(Picture);
"Employee Card".Picture.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream,IStream);
Bytes := MemoryStream.GetBuffer();
BaseImage := Convert.ToBase64String(Bytes);
END;
END;
<asp:Image id="ImgProfilePic" runat="server" />
string ProfilePicBase64 = "";
ProfilePicBase64 = cSite.ObjNav.GetProfilePicture(StaffNo);
ImgProfilePic.ImageUrl = "data:image/png;base64," + ProfilePicBase64;
check if image exits in folder X, if not fetch image & save to folder X.