0

SCENARIO

I currently have a bucket where all my images are hosted and stored. I currently display them by simply using URLs that link to the images (i.e https://[bucketName].s3.amazonaws.com/[imageName]).

I currently have over 22k photos in the bucket but I want migrate them over to the Drupal database.

PROBLEM

This was how I planned on resolving this:

  1. I was thinking of trying to find an API that would get a list of all the objects in my bucket.
  2. Then after getting the list off all the objects, use PHP's file_get_contents() function to get the image itself
  3. Then programmatically create the Media type after each URL request, by following what I saw here, Programmatically create media file or possibly doing this Create file/media

QUESTION

Is this a proper approach? Or is there a better way for me to approach this?

  • 1
    Might be possible with the Migrate API. – Kevin Jul 22 '19 at 14:04
  • 1
    I'd also suggest Migrate API. also check the contrib modules Migrate Plus and Migrate Tools, they might completely save you from custom coding. – Hudri Jul 22 '19 at 14:06
  • 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.