1

I've got a site where all the images for all the entries were added to a single, monolithic "Uploads" Asset volume, and I need to separate staff-uploaded images from user-uploaded images so the former can't accidentally use the latter.

The site has two sections: "Staff Articles", and "User Content". Both sections use the same custom Assets field: "Photos".

The "Staff Articles" section has perhaps a couple hundred photos spread across a few dozen entries. The "User Content" section has ~6,500 images, spread across ~1,500 entries.

I'm partway to a fix, but I need advice.

  • I've created a second "Images" Asset volume for the "Staff Articles" images.
  • I've renamed the "Photos" field to "User Photos", to leave the majority of the image assets in-place and as-is. The field is not (yet) restricted to a single Asset volume; it has access to both.
  • I plan to create a new field for the "Staff Articles" to use; let's call it "Staff Photos" for clarity. It, too, will initially have access to both Asset volumes.

I was planning to add the new "Staff Photos" field to the "Staff Articles" section, and then to manually edit each entry to re-select in the "Staff Photos" field whatever was already selected in the now-renamed "User Photos" field, but I'm not sure if there's not a better way.

So, what's the best way to "split" the assets apart? Specifically, to relocate the "Staff Articles" assets to their new "Images" volume, and have the entries updated to use the new "Staff Photos" field?

1 Answer 1

1

You may need to write some kind of utility code to assist you in this task.

I would use a console command for this that:

  • loops over the entries in the "Staff Articles" section
  • loops over the assets selected in the "Staff Photos" field
  • change their volume and folderId
  • save the assets

This may not be the best solution but should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.