有没有什么办法来设置一个长的URL字符串,而无需创建一个文件? [英] Is there any way to set a long url string without creating a file?

查看:179
本文介绍了有没有什么办法来设置一个长的URL字符串,而无需创建一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL Server表的图像,我想在开发前preSS ASPxImageZoom控件来显示。

I have images in an SQL Server table that I want to display in a Dev Express ASPxImageZoom control.

该控件有string类型的ImageUrl属性。

This control has an ImageUrl property of type string.

我不希望我的文件服务器上创建大量的临时文件。有没有什么办法可以设置的ImageUrl,而无需创建一个临时文件?

I don't want to create lots of temporary files on my file server. Is there any way I can set the ImageUrl without creating a temporary file ?

我写在开发前preSS XAF应用程序中使用的属性编辑器。
它包含code

I am writing a property editor for use in a Dev Express XAF application. It contains the code

protected override void ReadViewModeValueCore()
        {
            var zoom = (ASPxImageZoom)ZoomControl;  // where ZoomControl is a WebControl
            var bytes = (byte[])PropertyValue;
            if (bytes.Length <= 0)
            {
                return;
            }
            var base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
            zoom.ImageUrl = "data:image/png;base64," + base64String; // fails if length is too long.
        }

如果我有一个大的图像,我得到一个错误。

If I have a large image I get an error.

The specified path, file name, or both are too long. The fully qualified file     name must be less than 260 characters, and the directory name must be less than 248 characters

的控制设定的图像的唯一方法是通过设置的ImageUrl它是一个字符串

The only way of setting the image for the control is via setting the ImageUrl which is a string.

推荐答案

的问题解决了<一个href=\"http://stackoverflow.com/questions/34304258/how-do-i-set-the-contents-of-an-aspximagezoom-control\">this问题

    string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
    ASPxImageZoom1.ImageUrl = "data:image/png;base64," + base64String;    

这篇关于有没有什么办法来设置一个长的URL字符串,而无需创建一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆