1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    Schoumy is on a distinguished road

      0  

    Default Unanswered: Cannot use data:image/png;base64 in XTemplate

    Unanswered: Cannot use data:image/png;base64 in XTemplate


    Hi !

    I try to use XTemplate and insert a Base64 image in HTML.

    So i wrote :
    <img src="{image.base64}"/>

    With base64 = data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==

    But the image won't be displayed

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    You probably added it as a String, use a SafeUri instead. See the source for the example at http://www.sencha.com/examples-dev/#...Place:combobox

    Code:
      interface ComboBoxTemplates extends XTemplates {
     
        @XTemplate("<img width=\"16\" height=\"11\" src=\"{imageUri}\"> {name}")
        SafeHtml country(SafeUri imageUri, String name);
     
        @XTemplate("<div qtip=\"{slogan}\" qtitle=\"State Slogan\">{name}</div>")
        SafeHtml state(String slogan, String name);
     
      }

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    Schoumy is on a distinguished road

      0  

    Default


    Thx for answer me

    I try it and I receive a new error :

    SafeUri can only be used as the entire value of a URL attribute. Did you mean to use java.lang.String or SafeHtml instead?

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Please show the actual code you are writing, wrapped in a simple, standalone entrypoint so others can try it - it is difficult to debug a project just from an error message.

  5. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    Schoumy is on a distinguished road

      0  

    Default


    I have fixed my problem

    You had right, i replace the String argument by a SafeUri argument.

    view.setCell(new SimpleSafeHtmlCell<Image>(new AbstractSafeHtmlRenderer<Image>() {

    @Override
    public SafeHtml render(Image object) {
    return r.renderItem(UriUtils.fromTrustedString(object.getBase64()),object.getName(), style);
    }
    }));

    And

    @FormatterFactories(@FormatterFactory(factory = ShortenFactory.class, name = "shorten"))
    interface Renderer extends XTemplates {
    @XTemplate("<img width=\"100\" height=\"100\" src=\"{base64}\"> {name}")
    public SafeHtml renderItem(SafeUri base64, String name, Style style);
    }


    It works, thanks a lot !

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi