Author Topic: Retrieve diagram images and decode the Base64 content  (Read 5255 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Retrieve diagram images and decode the Base64 content
« on: April 30, 2019, 08:13:50 pm »
Hi,
I need to get the saved image for a diagram provided the option "Auto create Diagram Image" is enabled.
I created a simple script that runs the following query:

select t_document.StrContent from t_document inner join t_diagram on t_document.ElementID = t_diagram.ea_guid where t_document.DocName = 'DIAGRAMIMAGEMAP' and t_diagram.ea_guid = '"& myDiag.DiagramGUID&"'

I tried to decode the resulting content but it doesn't produce a valid image ou zip file. Any idea?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #1 on: April 30, 2019, 10:55:52 pm »
Uh. Where do I find that option (and in which EA version)?

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Retrieve diagram images and decode the Base64 content
« Reply #2 on: April 30, 2019, 10:59:37 pm »
It's available since EA13 I think. In EA14, open menu Configure > (Model) Options, then Cloud > Auto Create.
Once enabled, modify and save a diagram -> it will create an image in the DB

There's an option to run a batch update on all existing diagrams (it can take a while).

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #3 on: April 30, 2019, 11:06:26 pm »
I don't have that Cloud option. Sorry then.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Retrieve diagram images and decode the Base64 content
« Reply #4 on: April 30, 2019, 11:11:02 pm »
In EA13.5, it's under Configure > Options > General
Then Data Cache at the bottom of the popup.

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #5 on: April 30, 2019, 11:53:32 pm »
Found it. Will have a look...

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #6 on: May 01, 2019, 12:00:02 am »
That's indeed no zip. And also it's no native BMP, PNG or JPG. I suspect it's some Sparxian alien blob.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Retrieve diagram images and decode the Base64 content
« Reply #7 on: May 01, 2019, 12:02:20 am »
Hopefully the blob can be demystified by its creator  ;)
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #8 on: May 01, 2019, 12:04:51 am »
I have no idea what they use it for. The best you can do is to create a image via API when you need it (though this needs opening the diagram tab ad dealing with potential diagram changes when it's already open).

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Retrieve diagram images and decode the Base64 content
« Reply #9 on: May 01, 2019, 03:11:10 am »
Actually the fastest way to export diagramImages is to export a package to xmi (with the option to include the diagram images)
A bonus is that EA doesn't open all those diagrams in the GUI.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Retrieve diagram images and decode the Base64 content
« Reply #10 on: May 01, 2019, 07:24:17 am »
with the option to include the diagram images

That's indeed tricky :-)

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Retrieve diagram images and decode the Base64 content
« Reply #11 on: May 02, 2019, 05:38:42 pm »
Thanks for your answers
Howerver I'm looking for a more dynamic option that doesn't use an XMI file.
I'll continue investigating..

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 320
  • Karma: +15/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
Re: Retrieve diagram images and decode the Base64 content
« Reply #12 on: May 02, 2019, 06:24:55 pm »
These diagram images can only be accessed through the PCS APIs (AFAIK), and this was primarily introduced for Webtools  Prolaborate, WebEA etc (AFAIK)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1370
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Retrieve diagram images and decode the Base64 content
« Reply #13 on: May 03, 2019, 04:16:47 pm »
Thanks for the clarification Nizam.
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com