2015-11-27 45 views
1

我試圖通過transloadit程序集處理後在同一頁上顯示結果圖像。 JavaScript代碼似乎是正確的,但圖像沒有顯示在頁面上。 這是我在實施它的live頁面。圖像結果未在頁面上顯示

以下是我的代碼,請幫忙!

<form action="" enctype="multipart/form-data" method="POST"> 
    <input type="file" name="my_file" multiple="multiple" /> 
</form> 
<div id="thumbnail"></div> 

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> 
<script src="//assets.transloadit.com/js/jquery.transloadit2-v2-latest.js"></script> 
<script type="text/javascript"> 

$(function() { 
    $('form').transloadit({ 
    wait: true, 
    triggerUploadOnFileSelection: true, 

onResult: function(step, result){ 
if (step=='thumb'){ 
$("#thumbnail").html("<img src=' " + result.url + " '/>"); 
} 
}, 


    params: { 
     auth: { key: "Public_Key" }, 
     steps: { 
     thumb: { 
      use: ":original", 
      robot: "/image/resize", 
      result: true, 
      resize_strategy: "pad", 
      background: "#000000", 
      format: "jpg", 

      watermark_url: "http://www.mygreencity.in/images/Pagdi.png", 
      watermark_size: "75%", 
      watermark_position: "center", 


     } 
     } 
    } 
    }); 
}); 
</script> 

回答

0

上傳和處理完成後顯示圖像。但是頁面重新加載。檢查PARAM自動提交

autoSubmit : Specifies whether to submit the original form automatically once the upload and processing have completed. This is true by default. 

https://github.com/transloadit/jquery-sdk

+0

非常感謝,這解決了這個問題。 –

+0

太棒了!請接受我的回答,然後@JamshedQureshi :) – henrik123