Пример #1
0
        private static string ImageAsset(int assetId, string fileName, string extension, IImageResizeSettings settings = null)
        {
            var pathFileName = Path.ChangeExtension(assetId + "_" + SlugFormatter.ToSlug(fileName), extension);
            var url          = "/assets/images/" + pathFileName;

            if (settings != null)
            {
                url += settings.ToQueryString();
            }
            return(url);
        }
        private static string GetUrl(IImageAssetRenderable asset, IImageResizeSettings settings = null)
        {
            var fileName = Path.ChangeExtension(SlugFormatter.ToSlug(asset.FileName), asset.FileExtension);
            var pathPart = asset.ImageAssetId + "-" + asset.FileStamp + "-" + asset.VerificationToken;
            var url      = $"/assets/images/{pathPart}/{fileName}";

            if (settings != null)
            {
                url += settings.ToQueryString();
            }

            return(url);
        }