Created
September 13, 2013 07:14
-
-
Save johanandren/6547569 to your computer and use it in GitHub Desktop.
Different handling for diferent kinds of images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ImageResource { | |
def publicUrl: String | |
} | |
case class URLImage(source: URL) extends ImageResource { | |
def publicUrl = source.url | |
} | |
case class CDNImage(bucketName: String, key: String, cdnBaseUrl: String) extends ImageResource { | |
lazy val cdnUrl = URL(cdnBaseUrl) :+ key | |
def publicUrl = cdnUrl.url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment