【问题标题】:Getting Path of image in html image tag.so how can i get URL of image from <img> tag?在 html 图像标签中获取图像的路径。那么如何从 <img> 标签中获取图像的 URL?
【发布时间】:2016-04-29 05:58:40
【问题描述】:

我正在使用 Telerik rad 图像编辑器。当我上传图片时,我使用 radimage.content 关键字来获取它的 url,但得到的 url 类似于 html 图片标签。所以我不能在另一个控件中使用它,因为它是 html 标签,而不是简单的 url 格式。

是否有任何关键字可以从 Telerik radimageeditor 获取 url 或从 html 图片标签获取 url? Image = reImage.Content; 用于获取 url 但现在正在获取 html 图片标签。

【问题讨论】:

  • 请帮我解决问题
  • 欢迎来到 Stack Overflow!我编辑了您的问题以缩进您的问题正文和代码示例,以便正确呈现 - 请参阅编辑帮助以获取有关格式的更多信息。请编辑以提供识别特定问题所需的任何其他详细信息。祝你好运!

标签: html asp.net telerik radeditor


【解决方案1】:

str = reImageAdd.Content; ;

            // Grab just the "src" attribute containing your image
            images = Regex.Match(str, "src=\"([^\"]*)\"").Groups[1].Value; // yields "http//www.abc.com/phoneimage.jpg"

首先将内容保存到一个字符串中。现在字符串 str 包含类似的内容,然后通过使用第二个代码块,我们可以找到路径和过滤器路径并保存到另一个字符串,这样我们就可以将该字符串保存到数据库中

【讨论】:

    猜你喜欢
    • 2015-12-17
    • 2011-03-26
    • 1970-01-01
    • 2018-06-23
    • 1970-01-01
    • 2015-03-19
    • 1970-01-01
    • 1970-01-01
    • 2014-09-26
    相关资源
    最近更新 更多