Save size and position (x, y and z)

Save size and position (x, y and z)

Hello, 

I would like to save in localstorage the position (x, y and z) and size of images using interaction ".draggable", ".resizable" and maybe ".sortable". I followed all the instructions of this post : "https://forum.jquery.com/topic/remember-position-and-size-in-a-cookie" and it works fine but only if all the images got different "id". And in my case all the images got the same "class" because I use PHP, GET, SESSION, foreach etc.

Does anybody have a solution ? Maybe save in localstorage and not cookies ? And use JSON ?

Thank you !