I want to do a sort of photo editor, i use uploadify to upload images
here are my files: http://www.mediafire.com开发者_StackOverflow社区/?3uzzgx5onzn
the problem is: after upload the images i dinamicaly generate a thumb .. When I click on it it show me the large pictures in another page, i want to show the picture in a div or a paragraf! after I refresh the page is working! why?
from my php script i recive only the image name (response) after UploadifyComplete i append this:
jQuery("#" + jQuery(this).attr('id') + ID).html('<a href="uploads/' + response + '"><img width="60px" height="60px" src="uploads/' + response + '" alt="' + response + '" /></a>');
to this:
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>');
}
and the result will be:
<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>
i putt all the images in 1 php array after all images uploaded i want to refresh the div where this code is:
<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>
i try with:
$('#mainftpQueue').load(location.href+" #mainftpQueue>*","");
$('#mainftpQueue').load("/ #mainftpQueue li");
buth no succes
sorry 4 my bad english.. if any 1 can edit this
thanks
You can't just load a part of a page like that. You'd need to use PHP. However, you could change the src attribute of the image tag dynamically to the thumbnail. Something like this will work:
var d = new Date();
$("img").each(function(i){
this.attr("src", "/"+this.attr('src')+"?"+d.getTime());
}
Source
The date part is to make sure it isn't cached by the browser. This iterates through all the images on the page and reloads them.
精彩评论