Rendering image by passing image ID to REST service

Post here questions and problems related to oXygen frameworks/document types.
Posts: 12

Rendering image by passing image ID to REST service

Fri Jun 17, 2016 6:05 am

In our document type, images are referenced by the image's asset ID in our asset management system:

<img src="1234567" alt="test image' />

In other content preview environments, images are previewed by passing the asset ID to a REST service: ... Id=1234567

... which returns an image rendition, usually in .png format.

If I actually edit the @src on the image to:

<img src=""

... I get the proper rendition and preview in Author. However, I'd prefer to not alter the @src in the content, but rather somehow implement some sort of image element display handler to iteratively pass each image asset ID in the open document to the service and allow service returns to drive image previews.

Could such an action or extension be implemented in Oxygen for previewing images in custom Document Type's Author mode? If it's not possible to do this without actually manipulating xml fragments in the open document, our documents are already being routed through transformation on save or re-upload, and functionality could be added to that transformation to strip the service call URL

Any advice?
Posts: 190

Re: Rendering image by passing image ID to REST service

Fri Jun 17, 2016 10:26 am


What you can do is to modify the image URL from CSS.
The following CSS sample changes the URL of all img elements by adding the "" prefix to the "src" attribute value:

Code: Select all

img {
    content: url(oxy_concat("", attr(src)));   

Best regards,
Mihaela Calotescu

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 1 guest