iwasnevy Posted November 29, 2008 Posted November 29, 2008 Help! I'm trying to display an animated gif on my layout using a web viewer. I can easily set up an absolute path to the file to accomplish this, but that's not a solid solution - if the computer gets renamed, replaced, if the database file gets moved, even if the .gif is moved with it, - anything could happen - the absolute path breaks. I can set up a calculated relative path to the database file, but if the databse does not reside on the startup drive, it's broken as well. (It's the way the path is calculated on a Mac - I can elaborate on why if anyone wants/needs.) Even then, if the database and the .gif are seperated, it's broken as well. A much better solution would be to embedd the .gif into the database by storing it in a global container field (which I've done) and then (in the webviewer) reference the .gif stored in the container field, but I haven't been able to come up with a way. Any help? Thanks
comment Posted November 29, 2008 Posted November 29, 2008 It's not possible to open an embedded file - you must export it first. A simple solution would be to have a startup script export the global field's contents to a known location (e.g. the temporary folder), and point the web viewer to there. Another option is to encode the image as base64 and embed it in the web viewer itself as part of the URL - see: http://en.wikipedia.org/wiki/Data:_URI_scheme This has the advantage of "marrying" the image permanently to the solution's schema, so that it persists even if the file is cloned.
iwasnevy Posted November 29, 2008 Author Posted November 29, 2008 (edited) Another option is to encode the image as base64 and embed it in the web viewer itself as part of the URL - see: http://en.wikipedia.org/wiki/Data:_URI_scheme This has the advantage of "marrying" the image permanently to the solution's schema, so that it persists even if the file is cloned. HAH! Elegant solution! Worked like a charm! I NEVER would have come up with that on my own! Thank you thank you thank you! If it helps anyone else searching on this, I couldn't quite figure out how to embed the Base64 data into the URL itself, so I wrote the Base64 data into HTML code, entered that code in a global field and called the html from that field up in the webviewer via the URL: "data:text/html," & fieldname. AWESOME! Here's the final result (file attached) - a cool progress indicator to give the user something to look at while FM goes in and cleans up errant empty records via a sript. Animated_Progress_Indicator.zip Edited November 29, 2008 by Guest
JerrySalem Posted December 9, 2008 Posted December 9, 2008 Thanks for sharing this great technique. Any smart people sitting around who can know why this works fine on my Mac, but not on my PC? Jerry
comment Posted December 9, 2008 Posted December 9, 2008 I haven't noticed you have edited your post. I couldn't quite figure out how to embed the Base64 data into the URL itself Here's an example. No fields are used for this - the image data is stored in the web viewer's definition. This way the file can be cloned without losing the image. WebViewerEmbed.fp7.zip 2
JerrySalem Posted December 10, 2008 Posted December 10, 2008 Yes I am using 9.0v3 I have tried the two posted files on OSX, XP and Vista They only work on the OSX Machine. I also put them on our FIlemaker server (Most up to date FMS9 on a PC Server) Open the file on a PC, big red X's, on Mac's beautiful stored gif's.
comment Posted December 10, 2008 Posted December 10, 2008 I really don't know. I would really like to hear from other forum members on Windows if it works for them.
Raybaudi Posted December 10, 2008 Posted December 10, 2008 Hi comment I'm working on this problem... On Windows that do not work but I think that it is only a minor bug with the code. I'll send the final solution, hoping that will work even on Macs. ( also I want to modify the code so that it do not display the WV borders. )
JerrySalem Posted December 10, 2008 Posted December 10, 2008 FYI On the windows platform the boarder around the Web Viewer can not be removed. (Must be a feature.) When ever I add a web viewer object to a layout it is always a royal pain to keep this in mind. Also the display is ALMOST exactly the same for both. Often you will need to resize the web viewer to a compromise size and placement for both platforms. Also keep in mind, the web viewer renders last. So you can't place any objects over it. Just in case you were trying to use it as a background on a layout. Jerry
Raybaudi Posted December 10, 2008 Posted December 10, 2008 On the windows platform the boarder around the Web Viewer can not be removed. That was true till 8.5 but on 9, with its ability to read data code, isn't any more.
comment Posted December 10, 2008 Posted December 10, 2008 So what exactly is the issue with the embedded base64 gif? Does it work if you embed it into an stand-alone html file?
comment Posted December 11, 2008 Posted December 11, 2008 I don't quite follow (but then what do I know about Windows...). Anyway, I don't think you need TWO html declarations: "data:text/html" should be enough. And the head part is also unnecessary, you can move directly to body - if it helps. How does this one look? WebViewerEmbed2.fp7.zip
Raybaudi Posted December 11, 2008 Posted December 11, 2008 Nope. I can't see anything I can see the gif only if I put the lonely: "data:image/gif;base64, [ code here ]" into the WV , but this don't let me hide the borders of the WV.
Raybaudi Posted March 28, 2009 Posted March 28, 2009 IE can't manage base64 ... That was true till the release of the last version ( 8 ) of Internet Explorer. Now all those problems are gone and we can see base64 code directly embedded into the Web Viewer, even in the format that can hide the Web Viewer borders. So, good news for windows users. : WVbase64.zip
Recommended Posts
This topic is 5730 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now