How to load images

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

How to load images

Post by manojdcoder » Thu Oct 29, 2020 12:20 am

Let's say I have the document below

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept props="something.." base="title.." id="a4">
<title id="v461357">Operating Guidelines</title>
<conbody>
<p>
<image href="Arm_Cuff_250X178_cae7dfb8-462a-40ae-bf41-0bde1b99160f.jpg" id="image_jyb_llz_lnb" />
</p>
</conbody>
</concept>


When the document is loaded in Editor, it tries to load image from "http://localhost:8080/web-author-compon ... 99160f.jpg" - where https//localhost:25608/ is the base path of document url.

I would like to customize the image path - may be point it to a different server / host, pass some additional parameter. Is there a way to intercept the request?

cristi_talau
Posts: 292
Joined: Thu Sep 04, 2014 4:22 pm

Re: How to load images

Post by cristi_talau » Thu Oct 29, 2020 12:38 am

Hello,

The default DITA CSS uses the value of the href attribute as the relative URL of the image, to be resolved against the URL of the topic. You can write your own CSS as part of a framework [1] to compute the URL in a different way. You can use some Oxygen-specific CSS extensions like oxy_concat(), oxy_substring() or even oxy_xpath() [2] based on the href value.

An example of such a CSS rule is the following:

Code: Select all

*[class~="topic/image"] {
  content: url(oxy_concat('https://oxygenxml.com/images/', attr(href)));
}
Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... works.html
[2] https://www.oxygenxml.com/doc/versions/ ... tions.html

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

Re: How to load images

Post by manojdcoder » Fri Oct 30, 2020 1:39 pm

Thank you for your reply. I followed custom framework sample, tried implementing a DITA extension, added the following CSS file to framework description

Code: Select all

<field name="authorExtensionDescriptor">
						<authorExtension>
							<field name="cssDescriptors">
								<cssFile-array>
									<cssFile>
										<field name="href">
											<String>${framework}/css/dita.css</String>
										</field>
										<field name="title">
											<String></String>
										</field>
										<field name="alternate">
											<Boolean>false</Boolean>
										</field>
									</cssFile>
								</cssFile-array>
							</field>
							<field name="mergeCSSsFromDocument">
								<Boolean>true</Boolean>
							</field>
						</authorExtension>
	</field>
Looks like it loads only my CSS file instead of merging it with existing DITA framework. Any thoughts what I'm missing?

mihaela
Posts: 228
Joined: Wed May 20, 2009 2:40 pm

Re: How to load images

Post by mihaela » Fri Oct 30, 2020 4:08 pm

Hello,

It seems that there is no CSS file from the base DITA framework specified in the list of your framework CSS files. Did you delete the "${baseFramework}/..." entries from the CSS list when creating the extension? You should try again to create the extension framework, leave the default CSS entries unmodified and just add your CSS file there.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

Re: How to load images

Post by manojdcoder » Fri Oct 30, 2020 9:01 pm

I manually created the framework, copied appropriate scripts from the sample project [here][https://github.com/oxygenxml/legalDocML]

I'm not sure how I can keep existing dita framework working and just merge my CSS files on top of it. Is there a documentation you could point me to?

cristi_talau
Posts: 292
Joined: Thu Sep 04, 2014 4:22 pm

Re: How to load images

Post by cristi_talau » Fri Oct 30, 2020 9:50 pm

Hello,

Here we describe how to create a framework extension [1]. This assumes you have Oxygen XML Editor installed.

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... zzf_pns_vz

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

Re: How to load images

Post by manojdcoder » Fri Oct 30, 2020 10:57 pm

Thanks for the link.

But I'm using the Web Author Integration Project - https://github.com/oxygenxml/web-author ... ntegration , any pointers for this type of project?

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

Re: How to load images

Post by manojdcoder » Sat Oct 31, 2020 12:57 am

Is it possible for you to give an example of custom .framework XML file that extends dita. In all my attempts it either loads my custom css file or only the bundled dita framework css files, not both.

cristi_talau
Posts: 292
Joined: Thu Sep 04, 2014 4:22 pm

Re: How to load images

Post by cristi_talau » Sat Oct 31, 2020 9:32 pm

Hello,

For Web Author Component Integration starter project, only the framework packaging is different [1]. However, frameworks can be uploaded from the Admin page as well after the resulting web application is installed.

Regarding the example framework, you can take a look at the LightWeight DITA framework included in the default Web Author installation.

What you should do after extending the framework is to leave all the inherited CSS files there and add your, and give it no title and mark it as non-alternate.

Best,
Cristian

[1] https://github.com/oxygenxml/web-author ... frameworks

manojdcoder
Posts: 26
Joined: Thu Oct 29, 2020 12:01 am

Re: How to load images

Post by manojdcoder » Tue Nov 03, 2020 7:10 pm

Thank you for the directions.

I already had a plugin, I noticed that I can add CSS to by plugin itself which was easier than extending a framework.

Once again, thank you very much for your support.

Post Reply