zoukankan      html  css  js  c++  java
  • 图片视频预览直接将请求下载的url(返回为流)操作和显示

    //看大图
    function ShowBidPic(src, flag) {
        var bigImg = "";
        if (flag == "1") {//视频
            bigImg = "<video src='..\..\" + src + "' autoplay='autoplay' controls='controls' height='448' width='100%' />";
        }
        else if (flag == "2") {//图片
            bigImg = "<div><img src='..\..\" + src + "' height='100%' width='100%'/></div>";
        }
        else if (flag == "3") {//网址
            bigImg = "<iframe width='800' height='450' id='YuFrame1' name='YuFrame1' src='" + src + "' style='position:absolute;background-color:antiquewhite;z-index:4;' frameborder='0' marginheight='0' marginwidth='0' allowTransparency='true'></iframe>";
        }
        else if (flag == "4") {//flash
            bigImg = "<embed height='448' allownetworking='internal' allowscriptaccess='never' width='100%' quality='high' invokeurls='false' src='..\..\" + src + "' type='application/x-shockwave-flash' wmode='transparent'>";
        }
    
    
        layer.open({
            title: 'Media Details',
            // btn: ['关闭'],
            area: ['800px', '530px'],
            type: 1,
            closeBtn: 1, //不显示关闭按钮
            shift: 2,
            shadeClose: true, //开启遮罩关闭
            content: bigImg
        });
    }
    

      完整的demo如下:

    利用参数下载图片或者视频的ajax

    var config = {
    url: urlFile,
    type: "get",
    dataType: "json",
    data: "",
    success: function(result) {
    
    }
    
    };
    $.ajax(config);

    再返回的函数中进行判断操作例如:

                        url =ctx +'system/sysAttachment/downLoadFile?fileid='+id;
                                    var bigImg =  "<video src=" + url + "  autoplay='autoplay' controls='controls' height='57%' width='60%' />";
                                    window.parent.layer.open({
                                        title: ['视频在线播放','color:#fff;background-color:#01AAED;'],
                                        btn: ['关闭'],
                                        area: ['60%', '93%'],
                                        type: 1,
                                        closeBtn: 1, //不显示关闭按钮
                                        shift: 2,
                                        shadeClose: true, //开启遮罩关闭
                                        content: bigImg
                                    });
  • 相关阅读:
    bzoj 3308 九月的咖啡店
    8.13模拟赛
    8.10模拟赛
    8.9模拟赛
    8.8模拟赛
    Codeforces Round #406 (Div. 2) D. Legacy (线段树建图dij)
    BZOJ 2957: 楼房重建 (分块)
    SPOJ BGSHOOT
    Codeforces Round #404 (Div. 2) E. Anton and Permutation(树状数组套主席树 求出指定数的排名)
    Lightoj-1356 Prime Independence(质因子分解)(Hopcroft-Karp优化的最大匹配)
  • 原文地址:https://www.cnblogs.com/wwwcf1982603555/p/13536366.html
Copyright © 2011-2022 走看看