I have a blob field (subtype bmp). I know this is going to be deprecated by media field type, but I still need it for display a picture in a repeater without using a brick view.
My question is how do I write this blob field with a stream. I mean, in a secondary table I have this blob field and when I link this table with an item no. I want to copy the picture of that item into this blob field. This is my code (inspired in a blog from Stefano Demiliani) but I must be doing something wrong, since picture does not show up.
local procedure loadMainPicture(sku: Code[20])
var
item: Record Item;
media: Record "Tenant Media";
instr: InStream;
outstr: OutStream;
temblob: Codeunit "Temp Blob";
begin
item.get(sku);
if item.Picture.Count = 0 then exit;
media.get(item.Picture.Item(1));
media.Content.CreateInStream(instr);
temblob.CreateInStream(instr);
temblob.CreateOutStream(outstr);
"Main Picture".CreateOutStream(outstr);
Modify;
end;