Any way to protect media folder using custom pipelines ?
I need to apply custom logic to the items inside the media library.
for example protecting certain files , apply custom weird logic.
my point is i want to write custom code to manage the reading of files
via pipelines.
i tried to build my own mediaurl provider
but this will only be called when you use .Url()
public class MyUrlProvider : IMediaUrlProvider
{
public UrlInfo GetMediaUrl(UmbracoContext umbracoContext, Umbraco.Core.Models.PublishedContent.IPublishedContent content, string propertyAlias, Umbraco.Core.Models.PublishedContent.UrlMode mode, string culture, Uri current)
{
//something happens here en you call .Url()
return null;
}
}
Then i tried to override the media URL
in different ways
// this should override all posible url slugs !!
//and it does but does not work with /media
RouteTable.Routes.MapRoute("MediaRoute", "{*permalink}", new
{
controller = "Media",
action = "IndexMedia",
},
constraints: new { name = new MediaContraint() }
);
//this works with media/someId/myimge.png
RouteTable.Routes.MapUmbracoRoute("MediaRoute", "media/{id}/{file}", new
{
controller = "Media",
id = UrlParameter.Optional,
file = UrlParameter.Optional,
action = "Index",
}, new test(),
constraints: new { name = new MediaContraint() });
I need to apply custom logic to the items inside the media library.
for example protecting certain files , apply custom weird logic. kroger hr expressmy
point is i want to write custom code to manage the reading of files
via pipelines. i tried to build my own mediaurl provider but this will
only be called when you use .Url()
public class MyUrlProvider : IMediaUrlProvider
{
public UrlInfo GetMediaUrl(UmbracoContext umbracoContext, Umbraco.Core.Models.PublishedContent.IPublishedContent content, string
propertyAlias, Umbraco.Core.Models.PublishedContent.UrlMode mode,
string culture, Uri current)
{
//something happens here en you call .Url()
return null;
}
} Then i tried to override the media URL in different ways
// this should override all posible url slugs !! //and it does but
does not work with /media
RouteTable.Routes.MapRoute("MediaRoute", "{*permalink}", new
{
controller = "Media",
action = "IndexMedia",
},
constraints: new { name = new MediaContraint() }
);
//this works with media/someId/myimge.png
RouteTable.Routes.MapUmbracoRoute("MediaRoute", "media/{id}/{file}", new
{
controller = "Media",
id = UrlParameter.Optional,
file = UrlParameter.Optional,
action = "Index",
}, new test(),
constraints: new { name = new MediaContraint() }); but does not work with this url /media/someID/mypicture.jpg?Width="300" i
found this articule but this not work with umbraco 8
https://farmcode.org/articles/securing-the-media-section-in-umbraco-behind-a-login/
The pipelines keep an internal queue of those media URLs which are currently If some file failed downloading, an error will be logged and the file won't be present in full is a sub-directory to separate full images from thumbnails (if used). You can override this method to customize the download path of each file.
Any way to protect media folder using custom pipelines ?
I need to apply custom logic to the items inside the media library. for example protecting certain files , apply custom weird logic. my point is i want to write custom code to manage the reading of files via pipelines. i tried to build my own mediaurl provider but this will only be called when you use .Url()
Then i tried to override the media URL in different ways
but does not work with this url /media/someID/mypicture.jpg?Width="300" i found this articule but this not work with umbraco 8 https://farmcode.org/articles/securing-the-media-section-in-umbraco-behind-a-login/
Would this article be of help?
https://codeshare.co.uk/blog/how-to-protect-media-items-in-umbraco/
There are also commercial packages that can protect media, to save you the trouble!
https://soetemansoftware.nl/media-protect
The pipelines keep an internal queue of those media URLs which are currently If some file failed downloading, an error will be logged and the file won't be present in full is a sub-directory to separate full images from thumbnails (if used). You can override this method to customize the download path of each file.
is working on a reply...