EPS Image Preview

Post here questions and problems related to oXygen frameworks/document types.
Miles Jeong
Posts: 2
Joined: Fri Jan 13, 2023 4:07 am

EPS Image Preview

Post by Miles Jeong »

Hello all,
I've been using a CMS in Oxygen XML Editor through WebDAV connection.
In Author mode, eps images in ditas are shown as tiff preview,
but the quality and redering performance is poor.
I want to display eps files with jpeg renditions in the CMS.
I tried to return jpeg content for eps via WebDAV but it didn't work. ("cannot display image" message shows up)
How can I override the default tiff preview behaviour for eps images in Author mode?
I have to consider when local files are opened. It's not going to be simple.

Regards,
Miles
Radu
Posts: 9273
Joined: Fri Jul 09, 2004 5:18 pm

Re: EPS Image Preview

Post by Radu »

Hello Miles,
Please see some answers below:
I've been using a CMS in Oxygen XML Editor through WebDAV connection.
Ok. What XML vocabulary are you using? Is it DITA XML, Docbook, or something else?
In Author mode, eps images in ditas are shown as tiff preview,
but the quality and redering performance is poor.
Yes.
I want to display eps files with jpeg renditions in the CMS.
I tried to return jpeg content for eps via WebDAV but it didn't work. ("cannot display image" message shows up)
As the URL extension remains "EPS" probably Oxygen triggers the same EPS rendering technique which attempts to find the TIFF inside the EPS.
How can I override the default tiff preview behaviour for eps images in Author mode?
The Author visual editing mode is CSS based, for example for DITA XML files the CSS selector which sets up the image rendering looks like this:

Code: Select all

*[class~="topic/image"] {
  content: attr(href, url);
}
One could add their own CSS customization, for example as a DITA XML framework extension if you are editing DITA XML:
https://blog.oxygenxml.com/topics/customizeDITACSS.html

and you can use CSS functions that Oxygen supports like oxy_replace:
https://www.oxygenxml.com/doc/versions/ ... ction.html
so you could actually instruct Oxygen to render a ".jpeg" URL instead of a ".tiff" URL and then handle the request of the JPEG url on the webdav server maybe.
I have to consider when local files are opened. It's not going to be simple.
Here you would need to have some kind of pairs, for each TIFF file have also a JPEG file in a sibling folder or in the same folder and again use CSS to redirect the reference to the TIFF to load the JPEG instead...

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Miles Jeong
Posts: 2
Joined: Fri Jan 13, 2023 4:07 am

Re: EPS Image Preview

Post by Miles Jeong »

Hello Radu,

Thank you for your help and it's really helpful.
Following "CSS Customization" instruction, I made a custom css and deployed like this.

*[class~="topic/image"][href$=".eps"]{
content: oxy_url(oxy_base-uri(), oxy_concat(attr(href, url), oxy_xpath("if (starts-with(base-uri(/), 'http://') or starts-with(base-uri(/), 'https://')) then '._rend_.jpg' else ''")));
}

this code adds '_rend_.jpg' suffix to the url if it ends with '.eps'. and then WebDAV returns jpg rendition content for the request.
It works great in Author view and I noticed this never works if the composite url ends with ".eps".
Last edited by Miles Jeong on Wed Nov 13, 2024 7:38 am, edited 1 time in total.
Post Reply