Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Refreshing TIWBSImage
#3
Hi, try to use IW Cache System:
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;
From here: https://github.com/Atozed/IntraWeb/blob/.../Unit5.pas
Reply


Messages In This Thread
Refreshing TIWBSImage - by pdinsd - 10-10-2019, 07:12 PM
RE: Refreshing TIWBSImage - by kudzu - 10-10-2019, 08:59 PM
RE: Refreshing TIWBSImage - by Jose Nilton Pace - 10-11-2019, 05:38 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)