How to auto-upload default images to staging server

Comments

1 comment

  • Official comment
    Avatar
    Danny Valentine

    Hi Steve, thanks for getting in touch.

    i don't have any suggestions for wiping previous data, but for creating data when populating your staging env, you might have some luck using Faker. It's a JS library used to create fake user data including name, email, location, etc. This can also provide you with user avatars that you can upload to your Cloudinary account, but this will cost you in terms of storage. 

    What I would suggest instead is using a default image placeholder. This would allow you to have unique filenames for each user in the fixture, but all point to the same image. For instance you could have https://res.cloudinary.com/demo/image/upload/d_avatar.png/jane_doe.png and https://res.cloudinary.com/demo/image/upload/d_avatar.png/mary_lou.png, but because they're using d_avatar.png, if a file doesn't exist with their username, it will fall back to the default image.

    Have a look at this article - it explains the process in a bit more detail, and gives example code in Ruby too.

    I hope this helps. If you have any further questions, please feel free to reply here or raise a support ticket if you prefer.

    Thanks,
    -Danny

    Comment actions Permalink

Please sign in to leave a comment.