skafy Posted July 3, 2017 Posted July 3, 2017 hi, how can i load picture into TUniURLFrame? I tried next those two dont work URLViewer.HTML.Add('<img src="/cache/Workflow_exe/'+ CacheFolder + '/' + Node.Text +'?fake='+ DateTimeToStr(Now) + '" style="width:100%;height:100%">') //DONT WORK URLViewer.HTML.Add('<iframe style="width:100%;height:100%;border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/cache/Workflow_exe/'+ CacheFolder + '/' + Node.Text +'?fake='+ DateTimeToStr(Now) +'");"></iframe>') //DONT WORK This one is working but sizes of picture are two big. scrollers appear. URLViewer.URL:= '/cache/Workflow_exe/' + CacheFolder + '/' + Node.Text +'?fake=' + DateTimeToStr(Now); 1 Quote
Sherzod Posted July 3, 2017 Posted July 3, 2017 Hi, Can you make screenshots and make a simple test case for what you wanted ? Best regards, Quote
skafy Posted July 4, 2017 Author Posted July 4, 2017 I cant figure it out how to add attachment. There is no where add attachment button. I've searched it all o.O. Basiclly what I want is to be able to insert image in TUniUrlFrame so that it fits. (I've tried width:100%;height:100% (no result)). But if I insert image with this URLViewer.URL:= '/cache/Workflow_exe/' + CacheFolder + '/' + Node.Text +'?fake=' + DateTimeToStr(Now); it shows image, but it also show picture in its natural scale, scrollers appear. I want insert image in TUniURLFrame so it fits (without scrollers) Quote
Sherzod Posted July 4, 2017 Posted July 4, 2017 Hi, I cant figure it out how to add attachment. There is no where add attachment button. I've searched it all o.O. "More Reply Options" button ? Quote
Sherzod Posted July 4, 2017 Posted July 4, 2017 Hi, Can you try this approach for now ?!: procedure TMainForm.URLFrameFrameLoaded(Sender: TObject); begin URLFrame.JSInterface.JSCode('try {var _img='#1'.iframe.contentWindow.document.images[0]; if (_img){_img.style["max-width"]="100%"; _img.style["max-height"]="100%";}} catch(e) {};'); end; Quote
skafy Posted July 5, 2017 Author Posted July 5, 2017 What unit need to add in namespace for JSIntergface. For now it is [dcc32 Error] Main.pas(51): E2003 Undeclared identifier: 'JSInterface' I'm using 0.99.96.1343 version. Quote
Sherzod Posted July 5, 2017 Posted July 5, 2017 Hi, I'm using 0.99.96.1343 version. Sorry, why ? Can you try to upgrade to the latest version and build ?! Quote
skafy Posted July 5, 2017 Author Posted July 5, 2017 I've updated and try it. It does not work. my code now is: procedure TMainForm.UniFormCreate(Sender: TObject); begin URLFrame.JSInterface.JSCode('try {var _img='#1'.iframe.contentWindow.document.images[0]; if (_img){_img.style["max-width"]="100%"; _img.style["max-height"]="100%";}} catch(e) {};'); end; procedure TMainForm.btnImageClick(Sender: TObject); begin ShowAttachment('Example.png'); end; procedure TMainForm.btnPDFClick(Sender: TObject); begin ShowAttachment('3.pdf'); end; procedure TMainForm.ShowAttachment(AFileName: string); begin URLFrame.HTML.Add('<iframe style="border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/files/' + AFileName +'?fake='+ DateTimeToStr(Now) +'");"></iframe>') end; Quote
Sherzod Posted July 7, 2017 Posted July 7, 2017 Hi, I've updated and try it. It does not work. my code now is: procedure TMainForm.ShowAttachment(AFileName: string); begin URLFrame.HTML.Add('<iframe style="border:none;background-repeat:no-repeat;background-sizecontain;background-image:url(/files/' + AFileName +'?fake='+ DateTimeToStr(Now) +'");"></iframe>') end; It seems that your HTML is not correct Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.