image
  • thumbnails
  • laravel-5.4
  • dropzone.js
  • 2017-07-16 33 views 4 likes 
    4

    我需要使用Laravel 5.4将预先存在的图像文件添加到dropzone。这就是为什么我使用createThumbnailFromUrl()函数。但它不能正确生成图像。相反,它以空白的方式显示它们。为此,我使用了该链接(jsfiddle)。我用Google搜索了很多,试了几种方法,但它并没有帮助:Dropzone createThumbnailFromUrl()问题

    下面是我的代码:

    <script type="text/javascript" src='{{asset("js/dropzone/min/dropzone.min.js")}}'></script> 
    <script type="text/javascript"> 
    
        Dropzone.options.addImages = { 
        paramName: "file", // The name that will be used to transfer the file 
        addRemoveLinks: true, 
        // The setting up of the dropzone 
        init:function() { 
    
         // Add server images 
         var myDropzone = this; 
         var existingFiles = [ 
         { name: "Filename 1.pdf", size: 12345678,imageUrl:'http://img.tfd.com/wn/93/17E8B3-awful.png' }, 
         { name: "Filename 2.pdf", size: 12345678,imageUrl:'http://img.tfd.com/wn/93/17E8B3-awful.png' }, 
         { name: "Filename 3.pdf", size: 12345678,imageUrl:'http://img.tfd.com/wn/93/17E8B3-awful.png' }, 
         { name: "Filename 4.pdf", size: 12345678,imageUrl:'http://img.tfd.com/wn/93/17E8B3-awful.png' }, 
         { name: "Filename 5.pdf", size: 12345678,imageUrl:'http://img.tfd.com/wn/93/17E8B3-awful.png' } 
         ]; 
    
         for (i = 0; i < existingFiles.length; i++) { 
    
          // alert(existingFiles[i].imageUrl); 
    
          myDropzone.emit("addedfile",existingFiles[i]); 
          myDropzone.files.push(existingFiles[i]); 
          myDropzone.createThumbnailFromUrl(existingFiles[i], existingFiles[i].imageUrl, function() { 
          myDropzone.emit("complete", existingFiles[i]); 
         }, "anonymous"); 
    
         } 
        }, 
    }; 
    </script> 
    

    下面是结果:(: enter image description here

    PS:任何形式的帮助。将不胜感激

    +1

    我面临同样的问题 –

    回答

    1
    +3

    请说明你的答案 –

    +0

    虽然此链接可以回答这个问题,这是更好在这里包括答案的基本部分,并提供参考链接。如果链接页面更改,则仅链接答案可能会失效。 - [来自评论](/ review/low-quality-posts/18260029) –

    0

    曾与悬浮窗5.3

    同样的问题,这个固定为我

    let mockFile = { name: "Loaded File", dataURL: relURL }; 
    dropzoneInst.files.push(mockFile); 
    dropzoneInst.emit("addedfile", mockFile); 
    dropzoneInst.createThumbnailFromUrl(mockFile, 
        dropzoneInst.options.thumbnailWidth, 
        dropzoneInst.options.thumbnailHeight, 
        dropzoneInst.options.thumbnailMethod, true, function (thumbnail) 
         { 
          dropzoneInst.emit('thumbnail', mockFile, thumbnail); 
         }); 
    dropzoneInst.emit('complete', mockFile); 
    
    相关问题