Basically my users have the ability to upload images for their product, the uploaded products are inputed using 10 picture uploaders, i have already allowed them to add the images, but now i want them to be able to go and edit their images. for example if they dont like image 2 and want to repalce it, i want them to be able to input a new image for #2 and add the new image in place of the one they uploaded previously. I want to also make sure it keeps the same order of 1-10 according to which image they replaced.
A bonus would also be if someone could tell me if there is a way to rearrange these images like in shopify by dragging them around and rearranging the order they are in.
But in that case, i would have to save them to a seperate data field and make each image a seperate entry with its own indexes. My images are within the product in âimagesâ and itâs a list of images. I want to be able to allow users to replace one of the images or even rearrange them and saving the new images and the positions back into the products images.
The plugin is useful for when the user is selecting many images at the same time, and then they can reorder, add or remove files from that list. Then, you can upload them all at once in the correct order (only interacting with the database one time).
What youâre talking about here is editing the order after itâs been uploaded. To do that, you can create a state on the page thatâs a list of images. To reorder the list, letâs say a user wants to swap image 1 and image 2. Create a new list with image 2 as the first item and image 1 as the second item. The rest of the items are then merged at the end of this list. When the user is done making changes, use âclear listâ on the field itâs stores in and then use âset listâ to update it
Another way is to wrap the image in a database thing that has a field called âorderâ, which you can use to sort the list and modify positions quite easily. Up to you
That is such great advice and your plugin is amazing! I am going to attempt what you have advised and let you know how it goes. Thank you so much again for your time!
I tried to do this but couldnt acheive it, I added a page where the user uploads their files, but i am making an edit product page where they select their product and can edit for example the order of their image, add images, or even remove images. this is the set up i have, not sure what im doing wrong. Thank you!
This Image is what happens when the user clicks their product to edit