Last active
October 27, 2015 15:04
-
-
Save SteveDesmond-ca/95a15721ddddf8fd010f to your computer and use it in GitHub Desktop.
server-side responsive 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
public FilePathResult Image(int id, int x, int y) | |
{ | |
var image = db.Images.First(i => i.ID == id); | |
var newPath = image.GetFile(imagePath, new Size(x, y)); | |
return File(newPath, "image/jpeg"); | |
} |
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
public string GetFile(string imageDirectory, Size size) | |
=> ImageRetriever.GetImage(imageDirectory, Name, size) | |
?? ImageCreator.CreateImage(imageDirectory, Name, size); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment