We are implementing a custom ContentProvider to read documents and images from an external PIM system. The PIM system hosts all images and we can query the system via a webbased api. The api supports requesting resized images by appending the size paramters on the url.
The ContentProvider we're implementing is meant to not store the image data itself but only store the id of the image so that we in the display template for the external image model use the id to setup the url to the api and get the image from there.
However, in EPiServer you are able to set the width and heigth of an image when using them in an editor for instance. Is there a way to get these settings when rendering the image? So in the Display Template we could append the width and height to the url when requesting it.
We are currently using EPiserver version 8.1
Can you explain a bit more how and where is this width/height set? Does the editor set the width and height in TinyMCE or it's on ImageFile level?
If it's TinyMCE, you could parse the HTML using HtmlAgilityPack and read width/height and set src accordingly, cache this as well.
In TinyMCE-editor when Insert/Edit an image there is the Apperance tab where you can set Dimensions and other things. Is it possible to get hold of these settings?
Ok Im running into issues with this type of implementation of the ContentProvider. Since we are not saving any Blob data and the image is read from an external source I'm unable to figure out how to be able to use the image in the editor.
It works when dragging it on to pages like blocks since I have created a Controller and View for it. In the view I can use code like above to render the image based on the model data. But is there any way of controlling how the custom content is rendered when used in the editor? It renders an image but the src for it is the internal EPiServer content link where I would like it to be replace by a property on the content itself.
Anyone have an idea?
I've got a similar question and Ben answered, but I didn't have a chance to try it out, but perhaps it will help you: http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2014/6/Is-it-possible-to-override-how-a-URL-is-rendered-in-TinyMCE-with-DisplayTemplates/
Thanks Marija. Thats solves the issue of being able to present the content in the editor. One issue still remains: since it is added as dynamic content I'm lacking a good way of controling the image width and height. Ok if I ask this to Ben in your other thread?