This works based on a filename convention which
uses the Itemnumber plus the file extension (GIF or JPG), in
a directory associated with the store. "DMStore" is the data module for the store.
procedure TfmAppPanel.waShowPictureExecute(Sender: TObject);
const
fileNotFound='/htdemo/shared/img/misc/blnk32.jpg';
var
a1,aItem,aShortFile:string;
begin
inherited;
with TwhWebActionEx(Sender).WebApp, DMStore do begin
// send the name of a valid (existing!) file, or a placeholder
aItem:=StringVar['CurrentItem'];
aShortFile:=aItem+'.gif';
a1:=StoreImgUrl+'/'+aShortFile;
// first see if the GIF file exists
if fileExists(trailingBackSlash(StoreImgPath)+StoreImgUrl+'\'+aShortFile) then begin
SendString('/'+a1);
exit;
end;
aShortFile:=aItem+'.jpg';
a1:=StoreImgUrl+'/'+aShortFile;
// then see if the JPG file exists
if fileExists(trailingBackSlash(StoreImgPath)+StoreImgUrl+'\'+aShortFile) then begin
SendString('/'+a1);
exit;
end;
SendString(fileNotFound);
end;
end;