Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Get EPiServer settings on Image for external resources


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

May 04, 2015 15:55

Hi, Tobias,

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.

May 04, 2015 16:45

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?

May 04, 2015 17:04

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?

May 06, 2015 16:52

Hi, Tobias,

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:

May 11, 2015 14:01

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?

May 11, 2015 15:48


May 11, 2015 15:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.