5 |
6 |
7 |
8 | @Html.Raw(Html.ResizePicture(Model.CurrentPage.MainImage, PictureProfiles.SampleImage, cssClass: "sample-css-class").ToHtmlString())
9 | @Html.ResizePicture(Model.CurrentPage.MainImage, PictureProfiles.SampleImage, cssClass: "sample-css-class")
10 |
11 |
12 |
13 | @Html.ResizePictures(new[]
14 | {
15 | Html.ResizeImage(Model.CurrentPage.XLImage).Quality(10),
16 | Html.ResizeImage(Model.CurrentPage.LGImage).Quality(10),
17 | Html.ResizeImage(Model.CurrentPage.MDImage).Quality(10),
18 | Html.ResizeImage(Model.CurrentPage.SMImage).Quality(10),
19 | Html.ResizeImage(Model.CurrentPage.XSImage).Quality(10)
20 | }, PictureProfiles.BootstrapGrid, cssClass: "sample-css-class")
21 |
22 | @Html.ResizePictures(new[]
23 | {
24 | Model.CurrentPage.XLImage,
25 | Model.CurrentPage.LGImage,
26 | Model.CurrentPage.MDImage,
27 | Model.CurrentPage.SMImage,
28 | Model.CurrentPage.XSImage
29 | }, PictureProfiles.BootstrapGrid, cssClass: "sample-css-class")
30 |
31 | @Html.ResizePicture(Model.CurrentPage.MainImage, PictureProfiles.SampleImage, cssClass: "sample-css-class")
32 | @Html.ResizePicture(Model.CurrentPage.MainImage.ResizeImage().Quality(10), PictureProfiles.SampleImage, cssClass: "sample-css-class")
33 | @Html.ResizePictureWithFallback(Model.CurrentPage.EmptyImage, PictureProfiles.SampleImage, "/noimage.jpg?scale=both", cssClass: "sample-css-class")
34 |
35 |
36 |
37 |
.Add()
38 |
39 |
.Width(200).Height(200).Scale(ScaleMode.Both).FitMode(FitMode.Crop))
40 |
41 |
42 |
43 |

44 |
45 |

46 |
47 |
48 |
49 |
.Add()
50 |
51 |
.Width(200).Height(200).Scale(ScaleMode.Both).FitMode(FitMode.Crop))
52 |
53 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/Views/VideoFile/Index.cshtml:
--------------------------------------------------------------------------------
1 | @using EPiServer.Framework.Web.Resources
2 | @model VideoViewModel
3 | @{
4 | ClientResources.RequireScript(Href("~/static/jwplayer/jwplayer.js"));
5 |
6 | //The video element's ID needs to be unique in order for several video blocks and possible the same video block, to work on the same page
7 | var containerId = "video-container-" + Guid.NewGuid().GetHashCode();
8 | }
9 | @Html.FullRefreshPropertiesMetaData(new []{"Url"})
10 | m.Url)>
11 |
14 |
15 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/Views/_viewstart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "~/Views/Shared/Layouts/_Root.cshtml";
3 | }
4 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/favicon.ico:
--------------------------------------------------------------------------------
1 | h ( ... >>> Ɋ9 777 000 $$$ 666 !!! ###
--------------------------------------------------------------------------------
/samples/SampleAlloy/module.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/CMS/CMS.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/modules/_protected/CMS/CMS.zip
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/CMS/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/EPiServer.Cms.TinyMce/EPiServer.Cms.TinyMce.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/modules/_protected/EPiServer.Cms.TinyMce/EPiServer.Cms.TinyMce.zip
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/EPiServer.Cms.TinyMce/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/EPiServer.Packaging.UI/EPiServer.Packaging.UI.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/modules/_protected/EPiServer.Packaging.UI/EPiServer.Packaging.UI.zip
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/EPiServer.Packaging.UI/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/Shell/Shell.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/modules/_protected/Shell/Shell.zip
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/Shell/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/modules/_protected/repository.config:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/noimage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/noimage.jpg
--------------------------------------------------------------------------------
/samples/SampleAlloy/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/samples/SampleAlloy/seq.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/seq.jpg
--------------------------------------------------------------------------------
/samples/SampleAlloy/winforms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/d07625bd7659aa8914e9e1a040f3cff2f917ce5e/samples/SampleAlloy/winforms.png
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/ContentReferenceExtensions.cs:
--------------------------------------------------------------------------------
1 | using EPiServer;
2 | using EPiServer.Core;
3 |
4 | namespace ImageResizer.Plugins.EPiServer
5 | {
6 | public static class ContentReferenceExtensions
7 | {
8 | public static UrlBuilder ResizeImage(this ContentReference image, int? width = null, int? height = null)
9 | {
10 | return HtmlHelperExtensions.ResizeImage(null, image, width, height);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/EPiServerBlobFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Specialized;
3 | using System.IO;
4 | using System.Threading.Tasks;
5 | using EPiServer;
6 | using EPiServer.Core;
7 | using EPiServer.Framework.Blobs;
8 | using EPiServer.Security;
9 | using EPiServer.ServiceLocation;
10 | using EPiServer.Web.Routing;
11 |
12 | namespace ImageResizer.Plugins.EPiServerBlobReader
13 | {
14 | // Original code (or at least as much as left from it):
15 | // http://world.episerver.com/Code/Martin-Pickering/ImageResizingNet-integration-for-CMS75/
16 | public class EPiServerBlobFile : IVirtualFileWithModifiedDate, IVirtualFileWithModifiedDateAsync, IVirtualFileAsync
17 | {
18 | private readonly UrlResolver _urlResolver;
19 | private Blob _blob;
20 | private IContent _content;
21 |
22 | public EPiServerBlobFile(string virtualPath, NameValueCollection queryString) : this(virtualPath, queryString, ServiceLocator.Current.GetInstance()) { }
23 |
24 | public EPiServerBlobFile(string virtualPath, NameValueCollection queryString, UrlResolver urlResolver)
25 | {
26 | _urlResolver = urlResolver;
27 | VirtualPath = virtualPath;
28 | QueryString = queryString;
29 | }
30 |
31 | public NameValueCollection QueryString { get; private set; }
32 |
33 | public Blob Blob => _blob ?? (_blob = GetBlob());
34 |
35 | private IContent Content
36 | {
37 | get
38 | {
39 | if (_content != null)
40 | {
41 | return _content;
42 | }
43 |
44 | _content = _urlResolver.Route(new UrlBuilder(VirtualPath));
45 | if (!_content.QueryDistinctAccess(AccessLevel.Read))
46 | {
47 | _content = null;
48 | }
49 |
50 | return _content;
51 | }
52 | }
53 |
54 | public bool BlobExists => Content != null;
55 |
56 | public string VirtualPath { get; }
57 | public Task OpenAsync()
58 | {
59 | return Task.FromResult(Blob?.OpenRead());
60 | }
61 |
62 | public DateTime ModifiedDateUTC
63 | {
64 | get
65 | {
66 | var trackable = Content as IChangeTrackable;
67 | return trackable?.Saved.ToUniversalTime() ?? DateTime.MinValue.ToUniversalTime();
68 | }
69 | }
70 |
71 | public Task GetModifiedDateUTCAsync()
72 | {
73 | return Task.FromResult(ModifiedDateUTC);
74 | }
75 |
76 | public Stream Open()
77 | {
78 | return Blob?.OpenRead();
79 | }
80 |
81 | private Blob GetBlob()
82 | {
83 | var binaryStorable = Content as IBinaryStorable;
84 | return binaryStorable?.BinaryData;
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/HtmlHelperExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Web.Mvc;
3 | using EPiServer;
4 | using EPiServer.Core;
5 | using EPiServer.Web.Routing;
6 |
7 | namespace ImageResizer.Plugins.EPiServer
8 | {
9 | public static class HtmlHelperExtensions
10 | {
11 | public static UrlBuilder ResizeImage(this HtmlHelper helper, ContentReference image, int? width = null, int? height = null)
12 | {
13 | if(image == null || image == ContentReference.EmptyReference)
14 | throw new ArgumentNullException(nameof(image), "You might want to use `ResizeImageWithFallback()` instead");
15 |
16 | var url = UrlResolver.Current.GetUrl(image);
17 |
18 | return ConstructUrl(url, width, height);
19 | }
20 |
21 | public static UrlBuilder ResizeImageWithFallback(this HtmlHelper helper, ContentReference image, string imageFallback, int? width = null, int? height = null)
22 | {
23 | return ConstructUrl(image == null || image == ContentReference.EmptyReference ? imageFallback : UrlResolver.Current.GetUrl(image), width, height);
24 | }
25 |
26 | public static UrlBuilder ResizeImage(this HtmlHelper helper, string imageUrl, int? width = null, int? height = null)
27 | {
28 | if(string.IsNullOrEmpty(imageUrl))
29 | throw new ArgumentNullException(nameof(imageUrl), "You might want to use `ResizeImageWithFallback()` instead");
30 |
31 | return ConstructUrl(imageUrl, width, height);
32 | }
33 |
34 | public static UrlBuilder ResizeImageWithFallback(this HtmlHelper helper, string imageUrl, string imageFallback, int? width = null, int? height = null)
35 | {
36 | return ConstructUrl(string.IsNullOrEmpty(imageUrl) ? imageFallback : imageUrl, width, height);
37 | }
38 |
39 | private static UrlBuilder ConstructUrl(string url, int? width = null, int? height = null)
40 | {
41 | var builder = new UrlBuilder(url);
42 |
43 | if(width.HasValue)
44 | builder.Width(width.Value);
45 |
46 | if(height.HasValue)
47 | builder.Height(height.Value);
48 |
49 | return builder;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/ImageResizer.Plugins.EPiServerBlobReader.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $title$
7 | $author$
8 | $author$
9 | https://github.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader
10 | https://github.com/valdisiljuconoks/ImageResizer.Plugins.EPiServerBlobReader/blob/master/LICENSE
11 | false
12 | $description$
13 | Support for responsive picture element.
14 | Copyright 2021 (c) Valdis Iljuconoks, Tech Fellow
15 | EPiServer CMS ImageResizer Image Resizer BlobReader Blob ImageResizing Resizing Image Resizer ImageResizer.Net Imazen Imazen.Net
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/PictureProfile.cs:
--------------------------------------------------------------------------------
1 | namespace ImageResizer.Plugins.EPiServer
2 | {
3 | public class PictureProfile
4 | {
5 | public int DefaultWidth { get; set; }
6 |
7 | public int[] SrcSetWidths { get; set; }
8 |
9 | public string[] SrcSetSizes { get; set; }
10 |
11 | public string[] SrcMedias { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("ImageResizer.Plugins.EPiServerBlobReader")]
5 | [assembly: AssemblyDescription("ImageResizer library plugins for your Episerver site")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("Valdis Iljuconoks (Tech Fellow Consulting), https://tech-fellow.net")]
8 | [assembly: AssemblyProduct("ImageResizer.Plugins.EPiServerBlobReader")]
9 | [assembly: AssemblyCopyright("Copyright © 2021")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: ComVisible(false)]
13 | [assembly: Guid("aef92250-d8f9-4ce1-81ca-18c47b565d14")]
14 | [assembly: AssemblyVersion("7.3.0.0")]
15 | [assembly: AssemblyFileVersion("7.3.0.0")]
16 | [assembly: AssemblyInformationalVersion("7.3.0")]
17 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/ImageResizer.Plugins.EPiServerBlobReader/web.config.transform:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------