本文介绍了我如何使用pluploadQueue条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码

("#uploadContainer").pluploadQueue({
  // General settings
  runtimes : 'gears,html5,flash,silverlight,browserplus',
  url : '{$upSet.handler}',
  max_file_size : '{$upSet.maxFilesize}mb',
  chunk_size : '1mb',
  unique_names : false,
  prevent_duplicates: true,             
  // Specify what files to browse for
  filters : [
        { title : "Files", extensions : "{$upSet.allowedFileTypes}" }
    ],
  filters: {
        min_img_resolution: 8000000 // 1MP = 1 million pixels
    },
  // Flash settings
  flash_swf_url : '{$baseURL}/assets/plupload-2.1.2/js/Moxie.swf',              
  // Silverlight settings
  silverlight_xap_url : '{$baseURL}/assets/plupload-2.1.2/js/Moxie.xap'
                        }); 

我需要在第二个过滤器之前放置if条件,以选择不同的最小分辨率.我该怎么做?

I need to put if condition before second filter to choose different minimum resolution. How i can do this?

推荐答案

您不能进入上载者的设置.您需要在外部进行此操作:

You can't inside of the uploader's settings. You would need to do this outside:

var min_img_resolution = 8000000; // default

if (whatever) {
    // change default if condition is met
    min_img_resolution = 4000000;
}

("#uploadContainer").pluploadQueue({
    runtimes : 'gears,html5,flash,silverlight,browserplus',
    url : '{$upSet.handler}',
    max_file_size : '{$upSet.maxFilesize}mb',
    chunk_size : '1mb',
    unique_names : false,
    prevent_duplicates: true,             
    filters : [
        { title : "Files", extensions : "{$upSet.allowedFileTypes}" }
    ],
    filters: {
        min_img_resolution: min_img_resolution // add variable here
    },
    flash_swf_url : '{$baseURL}/assets/plupload-2.1.2/js/Moxie.swf',              
    silverlight_xap_url : '{$baseURL}/assets/plupload-2.1.2/js/Moxie.xap'
}); 

这篇关于我如何使用pluploadQueue条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 08:02