views:

364

answers:

1

hello, I want to do a sort of photo editor, i use uploadify to upload images

here are my files: http://www.mediafire.com/?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

+1  A: 

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.

Arda Xi
i edit my question! where i can put your function? thanks
robert
My code will simply go wherever you were planning to put the `$('#mainftpQueue').load(location.href+" #mainftpQueue>*","");`.
Arda Xi
:(( is not working, it stops after uploadi get this:assignment to undeclared variable d[Break on this error] d = new Date();
robert
Try `var d = new Date();` instead.
Arda Xi
nope not working!i really need to get this done :((
robert