10-11-2019, 05:38 PM
Hi, try to use IW Cache System:
From here: https://github.com/Atozed/IntraWeb/blob/.../Unit5.pas
Code:
procedure TIWForm5.IWGradButton2Click(Sender: TObject);
var
xFileName: string;
xURL: string;
begin
// get a new temp file name. This method only returns a file name, the file is not created
xFileName := TIWAppCache.NewTempFileName;
// copy a sample image file to our new cache file. We are just simulating a dynamic image file creation
FileCopy(TIWAppInfo.GetAppPath + 'web1.jpg', xFileName, True);
// add the image file to the cache. cache type is defined as ctOneTime, i.e., the file will be deleted when served
xURL := TIWAppCache.AddFileToCache(Self, xFileName, TIWMimeTypes.GetAsString(mtJPG), ctOneTime);
// open a new window with our image file
WebApplication.NewWindow(xURL);
end;
Code:
var
xFileName: string;
xURL: string;
begin
CurDir := TIWAppInfo.GetAppPath;
logostr:=Curdir+'wwwroot/iwbs/images/'+tenant+'logo.png';
if (fileexists(logostr)) then
begin
// get a new temp file name. This method only returns a file name, the file is not created
xFileName := TIWAppCache.NewTempFileName;
// copy your image file to our new cache file. We are just simulating a dynamic image file creation
FileCopy(logostr, xFileName, True);
// add the image file to the cache. cache type is defined as ctOneTime, i.e., the file will be deleted when served
xURL := TIWAppCache.AddFileToCache(Self, xFileName, TIWMimeTypes.GetAsString(mtJPG), ctOneTime);
currentLogo.ImageFile:=xURL;
tenantTabOptionsPage3.Repaint;
end;