英文:
Optimizely get media item from internal URL
问题
我有一个Optimizely块上的URL属性类型,它可以是外部URL或媒体项目。当渲染时,URL的格式是:/link/some_kind_of_id.aspx
。
这个相对URL将起作用,因为Epi HTTP处理程序将确定它是否是媒体项目,并返回资源。
我需要做的是以编程方式使用这个ID来确定URL是否是上传的媒体项目的URL,以便我可以获取上传的媒体项目的文件名并进行一些额外的处理。
但是,我找不到任何关于旧或新的Epi/Opti文档/指南的信息。
我希望我可以使用类似ContentLoader的东西来获取内容,或者使用BlobFactory。前者需要内容链接,后者需要GUID - 我都没有。
是否有任何办法可以通过它的“UriInternal”链接以编程方式获取URL属性值的更多信息?
谢谢!
英文:
I have a URL property type on an Optimizely block that could be an external URL or media item.
When rendered, the the URL is of the format: /link/some_kind_of_id.aspx
That relative URL will work, as the Epi HTTP handler will determine if it's a media item or not, and return whatever the resource is.
What I need to do is programmatically use this ID to determine if the URL is that of an uploaded media item so I can get the filename of the uploaded media item and do some additional processing.
However, I can't find any information in any old or new Epi/Opti documentation/guides.
I was hoping I could use something like the ContentLoader to get the content or the BlobFactory. The former requires a content link and the latter requires a GUID - I have neither.
Is there any way I can programmatically get more info from a URL property value via it's "UriInternal" link?
TIA
答案1
得分: 1
IUrlResolver.Route(...)
有一个重载,它接受一个UrlBuilder
,您可以在其中传递此值。如果它返回一个IContent
对象,那么您就知道它是一个内容项。然后,您可以检查它是否是一个IContentMedia
。
英文:
IUrlResolver.Route(...)
has an overload that takes an UrlBuilder
where you can pass in this value. If it return an IContent
object, then you know it's a content item. You can then check if it's an IContentMedia
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论