* Update Travis.yml * Update README * Update README * Adjust test to not rely on env vars * Update encryption * Refactor * Update env key * Stub AWS calls * Create ApplicationConfig * Fix specs * Fix lint * Update ApplicationConfig * Remove travis env vars * Fix lint * Extend character limit to 100 * Add env to travis * Take out auto-restart after deploy * Immediately discarded test cache * Stub GA in request specs * Stub Pusher * Fix broken specs * Update fixture * Add CodeClimate id * Change CodeClimate key * Remove merge mistakes * WIP * Add Envied gem & Change README * Add missing keys * Add missing key * Update fixture * Fix broken spec * Add Slack Notification for Travis * Fix wording * Fix typo
30 lines
969 B
Ruby
30 lines
969 B
Ruby
class ProfileImage
|
|
include CloudinaryHelper
|
|
attr_accessor :resource, :image_link, :backup_link
|
|
|
|
def initialize(resource)
|
|
@resource = resource
|
|
@image_link = resource.profile_image_url
|
|
@backup_link = "https://thepracticaldev.s3.amazonaws.com/i/99mvlsfu5tfj9m7ku25d.png"
|
|
end
|
|
|
|
def get(width = 120)
|
|
cl_image_path(get_link,
|
|
type: "fetch",
|
|
crop: "fill",
|
|
width: width,
|
|
height: width,
|
|
quality: "auto",
|
|
flags: "progressive",
|
|
fetch_format: "auto",
|
|
sign_url: true)
|
|
end
|
|
|
|
def get_link
|
|
image_link || backup_link
|
|
end
|
|
|
|
def get_external_link
|
|
image_link ? "#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}#{image_link}" : backup_link
|
|
end
|
|
end
|