Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery.filer-wordpress中的简单HTML5文件上传器图像删除_Javascript_Php_Jquery_Wordpress_Html - Fatal编程技术网

Javascript jQuery.filer-wordpress中的简单HTML5文件上传器图像删除

Javascript jQuery.filer-wordpress中的简单HTML5文件上传器图像删除,javascript,php,jquery,wordpress,html,Javascript,Php,Jquery,Wordpress,Html,我在wordpress上使用jquery文件服务器html5上传程序。我想删除编辑后页面上的图像。有人能帮忙吗?我在ajax\u remove\u file.php中使用函数jquery filer html5 uploaderunlink() jQuery(document).ready(function($) { //Example 2 $("#filer_input2").filer({ <?php

我在wordpress上使用jquery文件服务器html5上传程序。我想删除编辑后页面上的图像。有人能帮忙吗?我在ajax\u remove\u file.php中使用函数jquery filer html5 uploader
unlink()

jQuery(document).ready(function($) {
    //Example 2
    $("#filer_input2").filer({
                <?php 
                    global $redux_demo;
                    $uploadlimit = $redux_demo['image-limit'];
                    $limitnum = 'null';
                    if(!empty($uploadlimit)){
                        $limitnum = $redux_demo['image-limit'];
                    }
                ?>
            limit: <?php echo $limitnum; ?>,
            maxSize: null,
            extensions: ["jpg", "png", "gif"],
            changeInput: '<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-text"><h4><?php _e('Drag & Drop IMAGE here','agrg') ?></h4> <span style="display:inline-block; margin: 15px 0">or</span></div><a class="jFiler-input-choose-btn">Browse IMAGE</a></div></div>',
            showThumbs: true,
            theme: "dragdropbox",
            templates: {
                    box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>',
                    item: '<li class="jFiler-item col-lg-3 col-md-4 col-sm-4 col-xs-12">\
                                            <div class="jFiler-item-container">\
                                                    <div class="jFiler-item-inner">\
                                                            <div class="jFiler-item-thumb">\
                                                                    <div class="jFiler-item-status"></div>\
                                                                    <div class="jFiler-item-info">\
                                                                            <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
                                                                            <span class="jFiler-item-others">{{fi-size2}}</span>\
                                                                    </div>\
                                                                    {{fi-image}}\
                                                            </div>\
                                                            <div class="jFiler-item-assets jFiler-row">\
                                                                    <ul class="list-inline pull-left">\
                                                                            <li>{{fi-progressBar}}</li>\
                                                                    </ul>\
                                                                    <ul class="list-inline pull-right">\
                                                                            <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
                                                                    </ul>\
                                                            </div>\
                                                    </div>\
                                            </div>\
                                    </li>', 
                    itemAppend: '<li class="jFiler-item col-lg-3 append col-md-4 col-sm-4 col-xs-12">\
                                <div class="jFiler-item-container">\
                                        <div class="jFiler-item-inner">\
                                                <div class="jFiler-item-thumb">\
                                                        <div class="jFiler-item-status"></div>\
                                                        <div class="jFiler-item-info">\
                                                                <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
                                                                <span class="jFiler-item-others">{{fi-size2}}</span>\
                                                        </div>\
                                                    {{fi-image}}\
                                                </div>\
                                                <div class="jFiler-item-assets jFiler-row">\
                                                        <ul class="list-inline pull-left">\
                                                                <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\
                                                        </ul>\
                                                        <ul class="list-inline pull-right">\
                                                                <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
                                                        </ul>\
                                                </div>\
                                        </div>\
                                </div>\
                                </li>',                     
                    progressBar: '<div class="bar"></div>',
                    itemAppendToEnd: false,
                    removeConfirmation: true,
                    _selectors: {
                            list: '.jFiler-items-list',
                            item: '.jFiler-item',
                            progressBar: '.bar',
                            remove: '.jFiler-item-trash-action'
                    }
            },
            dragDrop: {
                    dragEnter: null,
                    dragLeave: null,
                    drop: null,
            },
            uploadFile: {
                    url: "<?php wp_upload_dir(); ?>",
                    data: null,
                    type: 'POST',
                    enctype: 'multipart/form-data',
                    beforeSend: function(){},
                    success: function(data, el){
                            var parent = el.find(".jFiler-jProgressBar").parent();
                            el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
                                    $("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow");
                            });
                    },
                    error: function(el){
                            var parent = el.find(".jFiler-jProgressBar").parent();
                            el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
                                    $("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow");
                            });
                    },
                    statusCode: null,
                    onProgress: null,
                    onComplete: null
            },
            files:[<?php require_once(TEMPLATEPATH . '/inc/BFI_Thumb.php'); ?>
                    <?php
                        $count = 0;
                        $params = array( 'width' => 110, 'height' => 70, 'crop' => true );
                        $attachments = get_children(array('post_parent' =>          $current_post,
                                        'post_status' => 'inherit',
                                        'post_type' => 'attachment',
                                        'post_mime_type' => 'image',
                                        'order' => 'ASC',
                                        'orderby' => 'menu_order ID'));

                        foreach($attachments as $att_id => $attachment) {
                                        $attachment_ID = $attachment->ID;
                                        $attachment_title = get_the_title($attachment_ID);
                                        $full_img_url = wp_get_attachment_url($attachment->ID);
                                        $size = getimagesize($full_img_url);
                                        $ext = strtolower(end(explode('.', $full_img_url)));
                    ?>
                        {
                            name: "<?php echo $attachment_title; ?>.<?php echo $ext; ?>",
                            type: "image/<?php echo $ext; ?>",
                            size: "<?php echo $size; ?>",
                            id  :"<?php echo $attachment_ID; ?>",
                            file: "<?php echo $full_img_url; ?>",
                            url: "<?php echo $full_img_url; ?>"
                        },
                    <?php
                    $count++;
                        }
                    ?>
                ],
            addMore: false,
            clipBoardPaste: true,
            excludeName: null,
            beforeRender: null,
            afterRender: null,
            beforeShow: null,
            beforeSelect: null,
            onSelect: function () {
            // Mark as featured
            $('a.mark-featured').click(function(event){

                event.preventDefault();

                var $this = $( this );
                var starIcon = $this.find( 'i');

                if ( starIcon.hasClass( 'fa-star-o' ) ) {   // if not already featured

                    $('.jFiler-item-assets .featured-img-id').remove();      // remove featured image id field from all the gallery thumbs
                    $('.jFiler-item-assets .mark-featured i').removeClass( 'fa-star').addClass( 'fa-star-o' );   // replace any full star with empty star

                    var $this = $( this );
                    var input = $this.siblings( '.gallery-image-id' );      //  get the gallery image id field in current gallery thumb
                    var featured_input = input.clone().removeClass( 'gallery-image-id' ).addClass( 'featured-img-id' ).attr( 'name', 'featured_image_id' );     // duplicate, remove class, add class and rename to full fill featured image id needs

                    $this.closest( '.jFiler-item-assets' ).append( featured_input );     // append the cloned ( featured image id ) input to current gallery thumb
                    starIcon.removeClass( 'fa-star-o' ).addClass( 'fa-star' );      // replace empty star with full star

                }

            }); // end of mark as featured click event

        },
            afterShow: null,
            onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){
                    var file = file.url;
                    $.post('<?php echo get_template_directory_uri(); ?>/inc/ajax_remove_file.php', {file: file});
            },
            onEmpty: null,
            options: null,
            captions: {
                    button: "Choose Files",
                    feedback: "Choose files To Upload",
                    feedback2: "files were chosen",
                    drop: "Drop file here to Upload",
                    removeConfirmation: "Are you sure you want to remove this file?",
                    errors: {
                            filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.",
                            filesType: "Only Images are allowed to be uploaded.",
                            filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.",
                            filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB."
                    }
            }
    });

});
jQuery(文档).ready(函数($){
//例2
$(“#文件管理器_输入2”)。文件管理器({
限额:,
maxSize:null,
扩展名:[“jpg”、“png”、“gif”],
changeInput:'或浏览图像',
秀拇指:没错,
主题:“dragdropbox”,
模板:{
框:“
    ”, 项目:'
  • \ \ \ \ \ \ {{fi name | limito:25}}\ {{fi-size2}}\ \ {{fi image}}\ \ \
      \
    • {{fi progressBar}}
    • \
    \
      \
    • \
    \ \ \ \
  • ', itemAppend:“
  • \ \ \ \ \ \ {{fi name | limito:25}}\ {{fi-size2}}\ \ {{fi image}}\ \ \
      \
    • {{fi icon}}
    • \
    \
      \
    • \
    \ \ \ \
  • ', progressBar:“”, itemAppendToEnd:false, Remove确认:正确, _选择器:{ 列表:'.jFiler项目列表', 项目:'.jFiler项目', progressBar:“.bar”, 删除:'.jFiler项垃圾操作' } }, 拖缆:{ 德拉根特:空, dragLeave:null, drop:null, }, 上载文件:{ url:“”, 数据:空, 键入:“POST”, enctype:“多部分/表单数据”, beforeSend:function(){}, 成功:功能(数据,el){ var parent=el.find(“.jFiler jProgressBar”).parent(); el.find(“.jFiler jProgressBar”).fadeOut(“慢”,函数(){ $(“Success”).hide().appendTo(parent.fadeIn(“slow”); }); }, 错误:函数(el){ var parent=el.find(“.jFiler jProgressBar”).parent(); el.find(“.jFiler jProgressBar”).fadeOut(“慢”,函数(){ $(“Error”).hide().appendTo(parent.fadeIn(“slow”); }); }, 状态代码:null, onProgress:null, onComplete:null }, 档案:[ { 姓名:“.”, 键入:“image/”, 大小:“, id:“”, 文件:“”, 网址:“ }, ], 阿德莫尔:错, 剪贴簿粘贴:对, excludeName:null, beforeRender:null, afterRender:null, beforeShow:null, beforeSelect:null, onSelect:function(){