Create profile image generator (#8695)

* Create profile image generator

* Update spec/services/users/profile_image_generator_spec.rb

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Remove difficult cloudinary dependency

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
This commit is contained in:
Ben Halpern 2020-07-14 21:00:13 -04:00 committed by GitHub
parent 70a060b71c
commit ed7def0efa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,26 @@
module Users
module ProfileImageGenerator
EMOJI_IMAGES =
%w[dog-face_1f436.png
monkey-face_1f435.png
unicorn_1f984.png
mouse-face_1f42d.png
hamster_1f439.png
koala_1f428.png
bear_1f43b.png
panda_1f43c.png
penguin_1f427.png
spouting-whale_1f433.png
honeybee_1f41d.png
lion_1f981.png
tiger-face_1f42f.png
fox_1f98a.png
wolf_1f43a.png].freeze
BACKGROUND_HEXES = %w[#f68d8e #fce289 #f3f096 #55c1ae #88aedc #f8b4d0].freeze
def self.call
# This pulls from emojipedia source for the liberally open source twemoji lib.
# TODO: Make this much more interesting than just emojis.
"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/twitter/248/" + EMOJI_IMAGES.sample
end
end
end

View file

@ -0,0 +1,7 @@
require "rails_helper"
RSpec.describe Users::ProfileImageGenerator, type: :service do
it "returns an emoji url" do
expect(described_class.call).to start_with("https://emojipedia-us.s3")
end
end