Forum Stats

  • 3,781,547 Users
  • 2,254,529 Discussions
  • 7,879,751 Comments

Discussions

Convert SVG in PNG or View archive SVG in Cards

Someone can help me.

I want to use an image in the cards, but my plugin makes the image available to me in SVG and APEX can not show this type of file in the media of the cards, I thought about converting the SVG file in PNG or some configuration for APEX to recognize SVG files, has anyone passed or know a way to solve this problem?

Comments

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,336 Red Diamond

    APEX can not show this type of file in the media of the cards

    What makes you think that? Works for me.

    Alexander Costa Filho
  • Alexander Costa Filho
    Alexander Costa Filho Member Posts: 14 Green Ribbon

    These images of the vehicles are png or svg? 

    I'm working with a diagram, BPMN.io it makes me save the images in SVG, but I can not insert this SVG image in the CARDS, the method I'm using is to take a screenshot and insert the PNG image manually.

  • Alexander Costa Filho
    Alexander Costa Filho Member Posts: 14 Green Ribbon

    Sorry, I checked here by the console, and saw that the image is SVG, how did you insert it? Can you pass me one step by step?

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,336 Red Diamond

    Those are SVG images that I have had stored as static workspace files for years. They are just referenced in the region query as '#WORKSPACE_FILES#truck-delivery.svg' etc:

    select
        e.*
      , case mod(e.empno, 4)
          when 0 then '#WORKSPACE_FILES#truck-delivery.svg'
          when 1 then '#WORKSPACE_FILES#truck-flatbed.svg'
          when 2 then '#WORKSPACE_FILES#truck-tanker.svg'
          when 3 then '#WORKSPACE_FILES#truck-timber.svg'
        end truck
    from
        emp e
    

    The Media properties in the Cards attributes are simply:

    • Source: URL Column
    • URL Column: TRUCK

    Where are your images stored and what Media settings are you using?

    Alexander Costa Filho
  • Alexander Costa Filho
    Alexander Costa Filho Member Posts: 14 Green Ribbon

    The images are in XML stored in a column of a table, but I can do the conversion from XML to SVG, any tips on how to proceed? 

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,336 Red Diamond
    edited Nov 12, 2021 3:05PM

    The images are in XML stored in a column of a table, but I can do the conversion from XML to SVG, any tips on how to proceed?

    Two possibilities come to mind, depending on how many cards there are, how much XML needs to be converted:

    • Convert the XML to SVG, storing the results in the BLOB001 column of an APEX collection, join to the collection in the Cards region query, and configure the Media setting to use this as a BLOB Column.
    • Create an On-Demand page or application process (aka "AJAX Callback" when defined on a page) to convert the XML on the fly, and download it, with a column in the Cards query generating the required ODP URL and the Media settings configured for this as a URL Column.

    If this just-in-time approach to the conversion impacts performance, you might need to convert and store the SVG in a BLOB column when rows are created or edited.

    Alexander Costa Filho
  • Alexander Costa Filho
    Alexander Costa Filho Member Posts: 14 Green Ribbon

    Already thanks for the answers, but I'm not able to perform the inclusion, I added the files in Static Application Files but at the time of reference in the table, did not know which data put, I tried the address of the image but when i perform another section will disappear the image, through the reference did not work also, I'm going in a wrong way? If possible I would like more detailed help.

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,336 Red Diamond

    Already thanks for the answers, but I'm not able to perform the inclusion, I added the files in Static Application Files but at the time of reference in the table, did not know which data put, I tried the address of the image but when i perform another section will disappear the image, through the reference did not work also, I'm going in a wrong way?

    I don't understand that.

    If possible I would like more detailed help.

    The most effective way to do so is for you to reproduce the problem on apex.oracle.com, getting as far as you are able to on your own, and then sharing guest developer credentials with us so we can see the issue at first hand.

    Alexander Costa Filho
  • Alexander Costa Filho
    Alexander Costa Filho Member Posts: 14 Green Ribbon

    I sent you the information in a direct message, if possible let me know if you found the information, thanks for the help. 

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,336 Red Diamond

    Investigation revealed the problem to simply be lack of the proper configuration and storage of the BLOB data and metadata.

    Replacing this table structure:

    create table flow_foto 
      ( photo      blob, 
        id         number, 
        processos  varchar2(100), 
        url_column varchar2(300)
      )
    

    with an expanded one with additional columns to support APEX declarative BLOB functionality:

    create table flow_foto
      ( flow_foto_id              number generated always as identity not null, 
        process                   varchar2(256) not null, 
        process_diagram_blob      blob, 
        process_diagram_mime_type varchar2(256), 
        process_diagram_filename  varchar2(256), 
        process_diagram_timestamp timestamp (6),
     
        constraint flow_foto_pk primary key (flow_foto_id) using index
      )
    

    enabled the creation of standard report + form pages for upload of the SVG files, and their display in a Cards region using the basic Media settings.

    Alexander Costa Filho