Reordering images using drag and drop extension

I am using Drag and Drop extension to re-order images and then make the pdf accoringly. To do so I have used the logic as in this image:

To get the correct images in new rearranged order.
But the problem is that it sometimes gives the right image but sometimes it just duplicates a image 2 times and leave the original image.
There might be some problem in the logic I’m trying to use here:

I will be thankful to you, if you can help me.

1 Like