Author Topic: How to show EA diagram images of t_document in PHP application?  (Read 8171 times)

DeBAAT

  • EA User
  • **
  • Posts: 59
  • Karma: +2/-0
    • View Profile
For a project I'm working on, I'm trying to display EA images in a PHP web application.
So far, I've located the information in the t_document table, as also indicated in the post "https://sparxsystems.com/forums/smf/index.php/topic,47559.msg277179.html".
The images are also automatically generated with the cloud option as they show in WebEA.

Unfortunately, I cannot decode the string I find in the StrContent column of t_document to show on my PHP page.
It seems to be some string that would render as "image/png" but it doesn't show the image.
Decoding base64 doesn't help either.

Any suggestions are highly appreciated.

qwerty

  • EA Guru
  • *****
  • Posts: 13545
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #1 on: July 17, 2023, 05:34:21 pm »
It's a zip with a file str.dat inside that contains the information.

q.

DeBAAT

  • EA User
  • **
  • Posts: 59
  • Karma: +2/-0
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #2 on: July 17, 2023, 11:01:31 pm »
Thanks for the quick reply.

What do you mean with :
Quote
a zip with a file str.dat inside
?

Just using
Code: [Select]
gzuncompress($StrContent) or
Code: [Select]
gzdecode($StrContent) still doesn't render the image.

Looking at some example data, it looks like the information I receive is base64 encoded (some strings end with "==").
Should I then first do a base64 decode before the dzuncompress is applied?

qwerty

  • EA Guru
  • *****
  • Posts: 13545
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #3 on: July 18, 2023, 02:20:50 am »
Unzipping does not get the file. You will have to extract the file str.dat (to disk or if PHP offers that to a string). Try to save the binary to a file and you will be able to unzip it with Windoze tools. Helps seeing the obvious...

(Sorry, my last touch with PHP is 20 years or so ago. What a relief ;-)

q.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1295
  • Karma: +119/-10
  • Its the results that count
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #4 on: July 18, 2023, 05:40:51 pm »
Why create your own PHP website when you can just use ProCloud Server/ Prolaborate?
How much time and effort will you spend translating into cost compared to just purchasing procloud server/prolaborate? Is it worth it?
Happy to help
:)

Mauricio Moya (Arquesoft)

  • EA User
  • **
  • Posts: 340
  • Karma: +8/-4
  • EA Consulting and development in Spanish
    • View Profile
    • Arquehub Azure Module
Re: How to show EA diagram images of t_document in PHP application?
« Reply #5 on: July 21, 2023, 04:35:06 am »
Note you only have the images stored in the database if you have PCS licensed, because it is the only way to use the Worker that continuously create a cache of the recently saved diagrams as images in the database.

And of course, if you have the PCS licensed, maybe you would prefer to use WebEA instead of making you own PHP web app.

qwerty

  • EA Guru
  • *****
  • Posts: 13545
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #6 on: July 21, 2023, 09:53:46 am »
Pls. ignore my post above. You were talking about the PCS image store. You can't read those since EA's cache uses some proprietary format and (IIRC) only when using PCS.

q.

DeBAAT

  • EA User
  • **
  • Posts: 59
  • Karma: +2/-0
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #7 on: July 21, 2023, 07:33:57 pm »
Thanks for the concern about me spending my time ;)

And some reactions:
Quote
Note you only have the images stored in the database if you have PCS licensed, because it is the only way to use the Worker that continuously create a cache of the recently saved diagrams as images in the database.
The first part of this statement is not true. The Worker might be indeed only part of the PCS license. However, in the regular client application, there are some options related to Cloud behaviour. One setting enables EA to explicitly store the diagram image every time it is saved by the user. And a button is available to batch create all diagram images.
This could also be concluded from looking at the size of the QEA or EAP files. They are much larger after the batch creation of all images, provided they were not there yet.
I also believe there are even some drawbacks when using the Worker because that may render possibly unwanted results when the diagrams are changed without you intending. I sometimes have it when I turn back to a previously neatly created diagram which now shows some additional connections that were added on other diagrams since the last time I looked at this particular diagram.

Quote
Pls. ignore my post above. You were talking about the PCS image store. You can't read those since EA's cache uses some proprietary format and (IIRC) only when using PCS.
Your remark might be valid as I am not talking about the PCS image store. As explained above, these images are generated and stored in the repository, whether you are using PCS or not. There may be however a proprietary format used which is 'decoded' when using the WebEA PCS functionality.

qwerty

  • EA Guru
  • *****
  • Posts: 13545
  • Karma: +395/-300
  • I'm no guru at all
    • View Profile
Re: How to show EA diagram images of t_document in PHP application?
« Reply #8 on: July 21, 2023, 08:46:56 pm »
My memory about these pictures is faint. I seem to remember having looked into some cache pictures and found them to have some EA-internal format. So I put them in the "may-be-forgotten" chamber in my brain. Since I don't have PCS it's likely (except I was completely dreaming) that they are generated by common means in EA. Sorry about the confusion. I'm old and that's not getting better over time.

q.