views:

214

answers:

1

hy, i have a little, big problem here :)

after i upload some images i get a list with all the images. I have some jQuery function for rotate, duplicate, delete, shuffle images! when i select a image and hit delete i send a post to php with the alt="" value of the image,i identify the picture and edit.

I want to make a save button, Instead of sending a post every time i rotate a image, better send a post after editing the list of images with an array that contains all data?

my php array after upload looks like this:

[files] => Array
    (
        [lcxkijgr] => lcxkijgr.jpg
        [xcewxpfv] => xcewxpfv.jpg
        [rtiurwxf] => rtiurwxf.jpg
        [gsbxdsdc] => gsbxdsdc.jpg
    )

say that I uploaded 4 pictures,

  • firs picture i rotate 90 degrees
  • second i want to duplicate
  • third i rotate 270 degrees
  • and the fourth image i delete

i can do all this only with jQuery, but on the server the images are the same, after a refresh the images are the same

this is the list with the images:

<div class="upimage">
  <ul id="upimagesQueue">
    <li id="upimagesHPVEJM">               
      <a href="javascript:jQuery('#upimagesHPVEJM').showlargeimage('HPVEJM')">
        <img alt="lcxkijgr" src="uploads/s6id9r9icnp8q9102h8md9kfd7/lcxkijgr.jpg?1272087830477" id="HPVEJM" style="display: block;" >
      </a>
    </li>
    <li id="upimagesSTCSAV">               
      <a href="javascript:jQuery('#upimagesSTCSAV').showlargeimage('STCSAV')">
        <img alt="xcewxpfv" src="uploads/s6id9r9icnp8q9102h8md9kfd7/xcewxpfv.jpg?1272087831360" id="STCSAV" style="display: block;" >
      </a>
    </li>
    <li id="upimagesBFPUEQ">              
      <a href="javascript:jQuery('#upimagesBFPUEQ').showlargeimage('BFPUEQ')">
        <img alt="rtiurwxf" src="uploads/s6id9r9icnp8q9102h8md9kfd7/rtiurwxf.jpg?1272087832162" id="BFPUEQ" style="display: block;" >
      </a>
    </li>
    <li id="upimagesRKXNSV">               
      <a href="javascript:jQuery('#upimagesRKXNSV').showlargeimage('RKXNSV')">
        <img alt="gsbxdsdc" src="uploads/s6id9r9icnp8q9102h8md9kfd7/gsbxdsdc.jpg?1272087832957" id="RKXNSV" style="display: block;">
      </a>
    </li>
  <ul>
</div>

is ok if i make one array like this

array{
    imgFromLi = array(img1,img2,img3,img4,img5,img6)
    rotate = array{img1=90, img2=270, img3=90}
    delete = array{img4,img5,img6}
    duplicate = array{img2, img3}
}

how i can make/send/cache this array??

sorry for my very bad english

Edit:

Yes i use jSON to recive the array from php like this:

jQuery.post(script, postData, function(data) {
    if(data){
       jQuery("#upimagesQueue").text(' ');
        jQuery.each(data, function(ID, val) {
               jQuery("#upimagesQueue").listimages(ID, val);                                
               });
    }
}, "json");
+1  A: 

Maybe if you use JSON your code will be simpler, and will be easier to spot any problems right away.

Jorge
yep i use jSON to recive data
robertdd