| WebUrl | 31 |CacheUrl | 32 |Resolved | 33 |34 | |
|---|---|---|---|
| No cached image paths found | 39 ||||
| Please wait, it can take serveral minutes for servers to respond... | 43 ||||
| {{ image.weburl }} | 47 |{{ image.cacheurl }} | 48 |{{ image.resolved }} | 49 |50 | |
22 |
23 | change to:
24 |
25 |
26 |
27 | If you turn off the toolkit in web.config it should render as it would if you had used `GetCropUrl` directly, useful for development!
28 |
29 | Internally cache busting has been added, you can view this in the [dashboard](Umbraco-Dashboard.md).
30 |
31 | The toolkit also adds a UrlHelper `GetCropCdnUrl` method with a first parameter of type `ImageCropDataSet` for use with your own strongly typed models or mappers such as Ditto. See the [reference documentation](Reference.md) for more info
32 |
33 | ## 2. Static assets ##
34 |
35 | Where you would normally reference css, js or static images you can now use a UrlHelper method called `ResolveCdn`.
36 |
37 | e.g.
38 |
39 |
40 |
41 | change to:
42 |
43 |
44 |
45 | With the toolkit enabled, you should now see your asset paths change to absolute CDN reference.
46 |
47 | e.g.
48 |
49 |
50 |
51 | You can see that the toolkit has also added that all important cachebuster variable.
52 |
53 | ## 3. Downloads ##
54 |
55 | Where you might normally render a link to download a pdf or docx stored in Umbraco media you can now use the `ResolveCdn` UrlHelper
56 |
57 | e.g.
58 |
59 | Download Word Doc
60 |
61 | change to:
62 |
63 | Download Word Doc
64 |
65 | With the toolkit enabled, you should now see your media paths change to absolute CDN reference.
66 |
67 | e.g.
68 |
69 | Download Word Doc
70 |
71 | You can see that the toolkit has also added that all important cachebuster variable.
72 |
73 | ## 4. Static assets with ImageProcessor.Web commands ##
74 |
75 | Sometimes there might be some images with ImageProcessor.Web commands.
76 |
77 | e.g.
78 |
79 |
80 |
81 | change to:
82 |
83 |
90 |
91 | Internally cache busting has been added, you can view this in the [dashboard](Umbraco-Dashboard.md).
92 |
--------------------------------------------------------------------------------
/docs/Our.md:
--------------------------------------------------------------------------------
1 | The AzureCDNToolkit package allows you to fully utilise and integrate the Azure CDN with your Umbraco powered website using a "Origin Push" approach.
2 |
3 | **To Push or to Pull**
4 | You can use both a Push or a Pull origin approach to the Azure CDN with Umbraco since the release of the new Azure CDN (AzureEdge), this package supports only Push origin (storage) currently however it maybe extended to also support Pull in the future.
5 |
6 | There are three file types that should be served from CDN if you have one.
7 |
8 | - Assets - css, js & static images used by templates etc..
9 | - Images managed by Umbraco - cropped or not
10 | - Files - pdfs, docx etc
11 |
12 | The toolkit depends on two packages being installed, these are the [UmbracoFileSystemProviders.Azure](https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure) and the [ImageProcessor.Web Azure Blob Cache plugin](http://imageprocessor.org/imageprocessor-web/plugins/azure-blob-cache/)
13 |
14 | Once installed and setup the package provides UrlHelper methods to use for resolving url paths for assets and Image Cropper urls and also a value converter for the TinyMce editor so that images within the content are also resolved.
15 |
16 | Some examples:
17 |
18 | @Url.ResolveCdn("/css/style.css")
19 |
20 | @Url.GetCropCdnUrl(Umbraco.TypedMedia(1084), width: 150)
21 |
22 |
23 |
24 | When using these methods, the toolkit will attempt to resolve the urls to their **absolute** paths and **crucially** ensures that a cache busting querystring variable is added. Without the cache busting using the Azure CDN can become tricky when you want to update with new content. This has the added benefit of avoiding your site needing to handle any 301 redirects and also gets some optimisation benefit (PageSpeed etc).
25 |
26 | Some examples:
27 |
28 | 1. ``
29 | 2. `
`
30 | 3. `Download Word Doc`
31 |
32 | Becomes:
33 |
34 | 1. ``
35 | 2. `
`
36 | 3. `Download Word Doc`
37 |
38 | **Note**: this package is not compatible with [Slimsy](https://our.umbraco.org/projects/website-utilities/slimsy/) v1 (it should work with the upcoming Slimsy v2 using img srcset)
39 |
40 | ## NuGet ##
41 |
42 | It is highly recommended that you install this package via NuGet:
43 |
44 | Install-Package Our.Umbraco.AzureCDNToolkit -Pre
45 |
46 | ## Documentation ##
47 |
48 | 1. [Azure Setup](https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/blob/develop/docs/Azure-Setup.md)
49 | 2. [Umbraco Setup](https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/blob/develop/docs/Umbraco-Setup.md)
50 | 3. [Umbraco Implementation](https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/blob/develop/docs/Umbraco-Implementation.md)
51 | 4. [Umbraco Dashboard](https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/blob/develop/docs/Umbraco-Dashboard.md)
52 | 5. [Reference](https://github.com/CrumpledDog/Umbraco-AzureCDNToolkit/blob/develop/docs/Reference.md)
--------------------------------------------------------------------------------
/src/Our.Umbraco.AzureCDNToolkit/Cache.cs:
--------------------------------------------------------------------------------
1 | using Umbraco.Core.Logging;
2 |
3 | namespace Our.Umbraco.AzureCDNToolkit
4 | {
5 | using System;
6 | using System.Collections.Generic;
7 |
8 | public static class Cache
9 | {
10 | public static T GetCacheItem
`
37 | 3. `Download Word Doc`
38 |
39 | Becomes:
40 |
41 | 1. ``
42 | 2. `
`
43 | 3. `Download Word Doc`
44 |
45 | [](https://ci.appveyor.com/project/JeavonLeopold/umbraco-azurecdntoolkit)
46 |
47 | **Note**: this package is not compatible with [Slimsy](https://github.com/Jeavon/Slimsy) v1 (it should work with the upcoming Slimsy v2 using img srcset)
48 |
49 | ## Documentation ##
50 |
51 | 1. [Azure Setup](docs/Azure-Setup.md)
52 | 2. [Umbraco Setup](docs/Umbraco-Setup.md)
53 | 3. [Umbraco Implementation](docs/Umbraco-Implementation.md)
54 | 4. [Umbraco Dashboard](docs/Umbraco-Dashboard.md)
55 | 5. [Reference](docs/Reference.md)
56 |
57 | ## Installation ##
58 |
59 | Both NuGet and Umbraco packages are available.
60 |
61 | |NuGet Packages |Version |
62 | |:-----------------|:-----------------|
63 | |**Release**|[](https://www.nuget.org/packages/Our.Umbraco.AzureCDNToolkit/)
64 | |**Pre-release**|[](https://www.myget.org/feed/umbraco-packages/package/nuget/Our.Umbraco.AzureCDNToolkit)
65 |
66 | |Umbraco Packages | |
67 | |:-----------------|:-----------------|
68 | |**Release**|[](https://our.umbraco.org/projects/developer-tools/azure-cdn-toolkit-for-umbraco/)
69 | |**Pre-release**| [](https://ci.appveyor.com/project/JeavonLeopold/umbraco-azurecdntoolkit/build/artifacts)
70 |
--------------------------------------------------------------------------------
/src/Our.Umbraco.AzureCDNToolkit/Events/CacheEvents.cs:
--------------------------------------------------------------------------------
1 | namespace Our.Umbraco.AzureCDNToolkit.Events
2 | {
3 | using System.Collections.Generic;
4 |
5 | using Newtonsoft.Json;
6 |
7 | using global::Umbraco.Core;
8 | using global::Umbraco.Core.Cache;
9 | using global::Umbraco.Web.Cache;
10 | using global::Umbraco.Core.Logging;
11 |
12 | using CacheRefreshers;
13 | using Models;
14 |
15 | public class CacheEvents: ApplicationEventHandler
16 | {
17 | protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,
18 | ApplicationContext applicationContext)
19 | {
20 | CacheRefresherBase