image
  • thumbnails
  • laravel-5.4
  • dropzone.js
  • 2017-07-16 152 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); 
    
    相關問題