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.


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


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

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.