2010-04-10 80 views
0

後的照片列表我想要做一個排序的照片編輯器, 我使用uploadify上傳圖片如何刷新uploadify jQuery的

這裏有我的文件:http://www.mediafire.com/?3uzzgx5onzn

的問題是:上傳後圖像我dinamicaly生成一個拇指..當我點擊它顯示在另一個頁面的大圖片,我想顯示在div或paragraf圖片!我刷新頁面後正在工作!爲什麼?

從我的PHP腳本我recive只圖像名稱(響應) UploadifyComplete後,我把這段:

jQuery("#" + jQuery(this).attr('id') + ID).html('<a href="uploads/' + response + '"><img width="60px" height="60px" src="uploads/' + response + '" alt="' + response + '" /></a>'); 

這樣:

     jQuery(queue).append('<li class="uploadifyQueueItem">\ 
          <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span>\ 
          <div class="uploadifyProgress">\ 
           <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\ 
          </div>\ 
         </li>'); 
       } 

,其結果將是:

<div class="uploadifyQueue"> 
    <ul id="mainftpQueue"> 
    <li class="uploadifyQueueItem"> 
    <a href="uploads/Winter.jpg"><img height="60px" width="60px" alt="Winter.jpg" src="uploads/Winter.jpg"></a> 
    </li> 
    </ul> 
</div> 

我把1個php數組中的所有圖片放進去 畢竟圖片上傳我想刷新DIV哪裏這個代碼:

   <div class="uploadifyQueue"> 
      <?php 
      if ($_SESSION['files']){ 
       print '<ul id="mainftpQueue">'."\n"; 
        foreach($_SESSION['files'] as $image): 
         print '<li class="uploadifyQueueItem">'."\n"; 
          print '<a href="uploads/'.$image.'"><img height="60px" width="60px" alt="'.$image.'" src="uploads/'.$image.'"></a>'."\n"; 
         print "</li>\n"; 
        endforeach; 
       print "</ul>\n"; 
      } 
      ?> 
      </div> 

我試着用:

$('#mainftpQueue').load(location.href+" #mainftpQueue>*",""); 
$('#mainftpQueue').load("/ #mainftpQueue li"); 

buth沒有更迭

對不起4我的英文不好..如果有1可以編輯這個

感謝

回答

1

你不能只加載像THA頁面的一部分噸。你需要使用PHP。但是,您可以將圖像標記的src屬性動態更改爲縮略圖。像這樣將工作:

var d = new Date(); 
$("img").each(function(i){ 
    this.attr("src", "/"+this.attr('src')+"?"+d.getTime()); 
} 

Source

日期部分,以確保它不被瀏覽器緩存。這遍歷頁面上的所有圖像並重新加載它們。

+0

我編輯我的問題!在哪裏我可以把你的功能?謝謝 – robert 2010-04-10 16:13:08

+0

我的代碼只會在你打算放置'$('#mainftpQueue')。'(location.href +「#mainftpQueue> *」,「」);'。 – 2010-04-10 16:24:52

+0

:((不工作,上傳後停止 我得到這個: 分配給未聲明的變量d [打破這個錯誤] d = new Date(); – robert 2010-04-10 17:08:48