How to set a path for images?
-
- Posts: 17
- Joined: Fri Aug 29, 2014 11:03 pm
How to set a path for images?
Post by rmcilvride »
I am having difficulties getting the img.src.path parameter in my DocBook WebHelp Classic Ant Scenario to work. I need to put all my image files into a single directory, and have all the images in all my books and sets get their images from that directory. Specifically, the image files are located here:
And the book and set source files are here:
My understanding is that I can set the img.src.path to add a prefix to the image name attributes in each <imagedata/> entity in the code. So, as I see it, this scenario:
Scenario 1
used with
should work the same way as this scenario:
Scenario 2
used with
However, the Scenario 1 yields this output in the HTML:
This is not correct. On the other hand, Scenario 2 yields this output in the HTML:
This is the correct output, as it puts the image where it belongs.
I am using the default Docbook WebHelp Classic transformation scenario; the only edits made were to the img.src.path parameter. In Scenario 1 I have also tried the following:
The latter two were tried because the default for the base and output directories are both ${cfd}/out/webhelp/, which is 3 levels down from the Images directory.
I don't know if changing keep.relative.image.uris from 0 to 1 is supposed to have an effect on this behavior, but in any case, it doesn't seem to. The output is the same with either setting.
Interestingly, for generating PDFs from the same source code, this works:
What am I doing wrong here? How can I get this to work? Thanks for your help on this.
Code: Select all
C:/Activity/Cogent/Docs/DocsOx/Source/Images/
Code: Select all
C:/Activity/Cogent/Docs/DocsOx/Source/[document_name]/
Scenario 1
Code: Select all
img.src.path = ${cfd}/../Images/
Code: Select all
<imagedata fileref="cdh-prop-butlicenses.gif" align="center"/>
Scenario 2
Code: Select all
img.src.path =
Code: Select all
<imagedata fileref="../Images/cdh-prop-butlicenses.gif" align="center"/>
Code: Select all
<img src="file:///C:/Activity/Cogent/Docs/DocsOx/Source/TestBook1/cdh-prop-butlicenses.gif" align="middle" />
Code: Select all
<img src="images/cdh-prop-butlicenses_530326563.gif" align="middle" />
I am using the default Docbook WebHelp Classic transformation scenario; the only edits made were to the img.src.path parameter. In Scenario 1 I have also tried the following:
Code: Select all
img.src.path = ../Images/
img.src.path = ../../../Images/
img.src.path = ${cfd}/../../../Images/
I don't know if changing keep.relative.image.uris from 0 to 1 is supposed to have an effect on this behavior, but in any case, it doesn't seem to. The output is the same with either setting.
Interestingly, for generating PDFs from the same source code, this works:
Code: Select all
img.src.path = ../Images/
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to set a path for images?
Hi,
Sorry for the delay.
The official Docbook documentation for images:
http://www.sagehill.net/docbookxsl/Grap ... tions.html
So for HTML output you will need to specify a relative value for this parameter.
Regards,
Radu
Sorry for the delay.
The official Docbook documentation for images:
http://www.sagehill.net/docbookxsl/Grap ... tions.html
so if you use Oxygen editor variables in its value, then they will get expanded to absolute file paths and then the HTML image will point to the image using these absolute paths which you do not want. For PDF, these absolute paths will not matter because the resulting PDF will include the images inside it anyway but for HTML it does matter.If the img.src.path parameter is set, its value is prepended to each fileref value if it is not an absolute path. This parameter lets you specify the path to the image files when you build the HTML. If its value is images/ then a fileref value of caution.png is written to the HTML file as src="images/caution.png. But sure to include the trailing slash.
So for HTML output you will need to specify a relative value for this parameter.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 17
- Joined: Fri Aug 29, 2014 11:03 pm
Re: How to set a path for images?
Post by rmcilvride »
Hi Radu,
Thank you for this information. I have tried the following relative paths:
Since the images are here:
And the source files are here:
I would expect the relative path of "../Images/" to find the images, if the path is supposed to be relative to the place where the source files are located.
On the other hand, if the relative path is supposed to be relative to the place where the output is generated, I would expect this path to work: "../../../Images/" because the the output gets generated here:
I have also tried these relative paths, just to check:
But neither of these work, either. What am I still missing here? Just for your reference, error message I get is:
Thank you for this information. I have tried the following relative paths:
Code: Select all
img.src.path = ../Images/
img.src.path = ../../../Images/
Code: Select all
C:/Activity/Cogent/Docs/DocsOx/Source/Images/
Code: Select all
C:/Activity/Cogent/Docs/DocsOx/Source/[document_name]/
On the other hand, if the relative path is supposed to be relative to the place where the output is generated, I would expect this path to work: "../../../Images/" because the the output gets generated here:
Code: Select all
C:/Activity/Cogent/Docs/DocsOx/Source/[document_name]/out/webhelp/
(base.dir = ${cfd}/out/webhelp/)
Code: Select all
img.src.path = ../../Images/
img.src.path = ../../../../Images/
Code: Select all
java.io.IOException: The filename, directory name, or volume label syntax is incorrect; SystemID: file:/C:/Program%20Files/Oxygen%20XML%20Editor%2020/frameworks/docbook/xsl/com.oxygenxml.webhelp.classic/xsl/docbook/images.xsl; Line#: 45; Column#: 29
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to set a path for images?
Hi,
We seem to have some problems in our WebHelp classic output when it comes to handling this parameter, I will add an internal issue for it.
In the meantime, a possible fix:
1) In the XSLT stylesheet OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\com.oxygenxml.webhelp.classic\xsl\docbook\images.xsl comment out this entire XSL template:
2) In the build file OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\com.oxygenxml.webhelp.classic\build_docbook.xml search for:
and replace with:
3) Set the "img.src.path" parameter to a relative location like "../" and then publish.
You will need to manually copy the images folder in the proper location next to the output folder but at least the image paths will remain relative and prefixed with "../".
Regards,
Radu
We seem to have some problems in our WebHelp classic output when it comes to handling this parameter, I will add an internal issue for it.
In the meantime, a possible fix:
1) In the XSLT stylesheet OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\com.oxygenxml.webhelp.classic\xsl\docbook\images.xsl comment out this entire XSL template:
Code: Select all
<xsl:template match="@src[parent::xhtml:img]">
...
</xsl:template>
Code: Select all
<param name="keep.relative.image.uris" expression="0"/>
Code: Select all
<param name="keep.relative.image.uris" expression="1"/>
You will need to manually copy the images folder in the proper location next to the output folder but at least the image paths will remain relative and prefixed with "../".
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 17
- Joined: Fri Aug 29, 2014 11:03 pm
Re: How to set a path for images?
Post by rmcilvride »
Hi Radu,
Thank you for these suggestions. I followed these steps, and got it to work, but I was unable to set a path to my Images directory, like: "../../../Images", because as I understand it, that is not considered a relative path. Moving the images to the same directory as my source files, and using "../../" to move up two levels from the "out/webhelp/" output directory did work.
However, putting the images with the XML source files is inconvenient, since we have multiple source file directories, one for each book and one for each set, and many of the books share images. This means creating and maintaining multiple copies of our images.
For now, I will change the imagedata fileref attribute on each source code file from this:
to this:
This is not an ideal solution, but it will at least allow us to keep a single copy of all images. When do you expect to have a release of oXygen in which the WebHelp Classic output mechanism is fixed?
Best regards,
Bob
Thank you for these suggestions. I followed these steps, and got it to work, but I was unable to set a path to my Images directory, like: "../../../Images", because as I understand it, that is not considered a relative path. Moving the images to the same directory as my source files, and using "../../" to move up two levels from the "out/webhelp/" output directory did work.
However, putting the images with the XML source files is inconvenient, since we have multiple source file directories, one for each book and one for each set, and many of the books share images. This means creating and maintaining multiple copies of our images.
For now, I will change the imagedata fileref attribute on each source code file from this:
Code: Select all
<imagedata fileref="myimage.gif"/>
Code: Select all
<imagedata fileref="../Images/myimage.gif"/>
Best regards,
Bob
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How to set a path for images?
Hi Bob,
Unfortunately I cannot give you an estimate for when the DocBook WebHelp classic publishing will be fixed to support "img.src.path" in exactly the same way in which it supports the same parameter for XHTML based outputs. But when we do, we'll update this forum thread.
Regards,
Radu
Unfortunately I cannot give you an estimate for when the DocBook WebHelp classic publishing will be fixed to support "img.src.path" in exactly the same way in which it supports the same parameter for XHTML based outputs. But when we do, we'll update this forum thread.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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