1

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?

3
  • 1
    Might be possible with the Migrate API.
    – Kevin
    Commented Jul 22, 2019 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
    Commented Jul 22, 2019 at 14:06
  • 1
    Check this drupal.org/docs/8/modules/remote-stream-wrapper Commented Jul 22, 2019 at 14:07

0

Your Answer

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

Browse other questions tagged or ask your own question.