Author Topic: Getting Images from Pro-Cloud  (Read 186 times)

BuddyRobbins_Linquest

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Getting Images from Pro-Cloud
« on: July 12, 2018, 08:32:20 am »
Folks,
I'm using the ProCloud server to retrieve a diagram image.  I'm getting the byte-array in the xml for the image, but I'm unable to turn that image into a picture.  What's the trick?

XmlNode node = document.SelectSingleNode("//rdf:RDF/ss:features/ss:diagramimage/rdf:Description/ss:image", nsmgr);
if( node != null)
{
   string rawData = node.InnerText;
   rawData = rawData.Replace("\r\n", "");
   System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
   byte[] byteArray = encoder.GetBytes(rawData.ToCharArray());
   System.IO.File.WriteAllBytes(@"c:\budTemp\mypic.jpg", byteArray);
}

Madhav

  • EA Novice
  • *
  • Posts: 11
  • Karma: +1/-0
    • View Profile
    • Prolaborate
Re: Getting Images from Pro-Cloud
« Reply #1 on: July 12, 2018, 03:14:45 pm »
Hello BuddyRobbins,

What you get for images is not byte-array but base-64 encoded string. You can use it directly as image source.

As per your code, you can use "node" as image source.

BuddyRobbins_Linquest

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Getting Images from Pro-Cloud
« Reply #2 on: July 12, 2018, 11:38:40 pm »
Thanks,  That did the trick.