显示来自分贝角局部视图二进制图像

编程入门 行业动态 更新时间:2024-10-28 00:18:35
本文介绍了显示来自分贝角局部视图二进制图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是想用来显示JSON对象从网络API请求返回来内图像。我能够在我的角度部分显示字符串,数字和日期/时间,但无法得到显示图像。这里是其中包含我演讲的题目中的每个字段我的JSON对象(模型)类

I was trying to display image which is coming within the json object returning from an web api request. I'm able to display string, number and date/time in my angular partial but couldn't get the image displaying. here is my json object which contains each field of my topic (model) class

<Topic> <Body>dsadfsaadsfds</Body> <Created>2014-06-15T00:00:00</Created> <Flagged>false</Flagged> <Id>1022</Id> <PhotoFile> iVBORw0KGgoAAAANSUhEUgAAB2wAAAOiCAIAAAAzNbBAAAABiWlDQ1BJQ0MgUHJvZmlsZQAAKBWtkT1LA0EQht+L0SgJGCRoCpEFRSzu5IxFTLTJB5iIRYgKane5nImQj+NyIfoD7Gy0EG0U9S+INhaWYqGFIAjB3yAEAi.......... (I want to post screen shot but i can't due to lack of reputations.....) </PhotoFile> <Replies i:nil="true"/> <Title>csdaadsf</Title>

和这里是我的角度HTML部分:

and here is my angular html partial:

<a data-ng-href="#/message/{{ i.id }}">{{ i.title }}</a> </div> <div class="date span2"> {{ i.created | date:"medium" }} </div> <div class="contents span12"> {{ i.body }} </div> <img ng-alt="" src="{{'data:image'+i.photofile}}" /> </div>

`

既然我能得到其他属性的工作,我的棱角分明的工厂和控制器应工作。是否有什么毛病我在显示图像的角局部视图语法?谢谢

Since i can get other attributes working, my angular factory and controller should be working. Are there anything wrong with my syntax in angular partial view for displaying images? Thanks

推荐答案
  • 您不应该是采用了棱角分明的前pression作为值时,使用的src 属性。使用 NG-SRC 相反,它将保证图像不显示角有机会取代前pression之前。

  • You shouldn't be using the src attribute when using Angular expression as the value. Use ng-src instead, it will ensure the image don't show up before Angular has a chance to replace the expression.

    如果你已经显示的样本有效载荷完成时,会形成数据URI的方式是不完整的。根据图像的格式,标题应为

    If the sample payload you've shown is complete, the way you are forming the data URI is incomplete. Depending on the format of the image, the header should look like

    data:image/png;base64,[things in the JSON]

    您可以阅读更多关于格式 rel=\"nofollow\">

    You can read more about the format here

更多推荐

显示来自分贝角局部视图二进制图像

本文发布于:2023-11-01 07:27:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1548663.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分贝   视图   局部

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!