Load Image into Nav from URL

AntHillMobAntHillMob Member Posts: 79
edited 2011-04-07 in NAV Three Tier
I have the requiremnent to parse a website and load some images (with a known structure of URL) in a Blob object of a corresponsing record so it can be shown in a picture box.

I can achieve this by creating an add-in with a picture box that dispalys the image diorectly from the URL address quite simply, but this is another add-in to manage and it makes sense to actually store the image in the record as then it can be used elsewhere in the application. I can't quite get my head arround how to do this, especially given the 'limitations' of file handling on the RTC.

Any pointers welcome.

Comments

  • deV.chdeV.ch Member Posts: 543
    There are lots of way to do this, I would give this one a try:
    An addin with string based addin and convert the image you download to base64 send it back to nav (ControlAddinEvent), in NAV you convert it back & store it using this http://www.mibuso.com/forum/viewtopic.php?p=20166#p20166 method.

    If you know the url you can download the picture like this:
    WebClient Client = new WebClient ();
    Stream strm = Client.OpenRead ("http://domain.com/picture.png");
    
  • kinekine Member Posts: 12,562
    Or you can do the same with usage of .NET Interop directly from the client.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.