Rendering image by passing image ID to REST service
Post here questions and problems related to oXygen frameworks/document types.
Rendering image by passing image ID to REST service
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:
https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=1234567
... which returns an image rendition, usually in .png format.
If I actually edit the @src on the image to:
<img src="https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=1234567"
... 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?
<img src="1234567" alt="test image' />
In other content preview environments, images are previewed by passing the asset ID to a REST service:
https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=1234567
... which returns an image rendition, usually in .png format.
If I actually edit the @src on the image to:
<img src="https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=1234567"
... 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?
Re: Rendering image by passing image ID to REST service
Hi,
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 "https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=" prefix to the "src" attribute value:
Best regards,
Mihaela
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 "https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=" prefix to the "src" attribute value:
Code: Select all
img {
content: url(oxy_concat("https://publish.our_organization.org/content_automation/ws/v1/getImage?mediaId=", attr(src)));
}
Best regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service