Generate URL of an image field

imagem do calcada.JPG

Guys, what is the correct way to generate a url for an image field through JavaScript ?

I wanted to generate a Dashlet with the image , but do not know how this works in REST .

Parents
  • offtopic:

    Hello!

    Which plugin generates the dashlet with the 7 status in the top right side? "Fase de Construcao de Empreendimento"

    Thx fort the answer!

    A.

  • Hi Bruno,

    I guess that are two ways to manupulate this image element.

    1. First method would be to copy generic image field file from:  clients/base/fields/image/image.js

    into your custom module:   custom/modules/EMP_Enpreendimentos/clients/base/fields/image/image.js

    and to add a custom code for this images case.

    2. Second way would be to use in the _renderHTML() function in this record.js from EMP_Enpreendimentos:

    custom/modules/EMP_Enpreendimentos/clients/base/views/record/record.js

    and when page was rendered, than apply a custom manipulation of DOM code, possible also with a seTtimeout()  combination

  • Emil,

    His answer me help find the way but it was not the end , but fortunately managed to make the image appear on Dashlet .

    Answer below :

    imagem module.JPG

    imagem_dashlet.JPG

    I created only one function to make things simpler .

    /**GerarURLImage - Função para gerar url de imagem.
       @module:Name Module - ex:Accounts
       @id:record id - ex:18sd89as7d8172s
       @field:name field module - ex:img_client_c
    
       @return: url - Ex:
    
       Author:Bruno Ribeiro
    */
    
    GerarURLImage : function (module, id, field,_hash) {
        var url = app.api.buildFileURL({
        module : module,
        id : id,
        field : field
        }) + "&_hash=" + _hash;
      return url;
    },
    
Reply
  • Emil,

    His answer me help find the way but it was not the end , but fortunately managed to make the image appear on Dashlet .

    Answer below :

    imagem module.JPG

    imagem_dashlet.JPG

    I created only one function to make things simpler .

    /**GerarURLImage - Função para gerar url de imagem.
       @module:Name Module - ex:Accounts
       @id:record id - ex:18sd89as7d8172s
       @field:name field module - ex:img_client_c
    
       @return: url - Ex:
    
       Author:Bruno Ribeiro
    */
    
    GerarURLImage : function (module, id, field,_hash) {
        var url = app.api.buildFileURL({
        module : module,
        id : id,
        field : field
        }) + "&_hash=" + _hash;
      return url;
    },
    
Children
No Data