Page 1 of 1

Bypassing missing images without being visible in output

Posted: Wed Nov 02, 2016 5:40 pm
by John McGowan
Hi,

I am looking for a way to bypass images that are not in a referenced image directory.
I need to do this to streamline images when docs are translated externally or when the image is not applicable to a certain region or customer.
The issues is that I need to do this so that there is no visible hint in the DHTML output that the image is missing - as if in error.
Anyone know of a good way to do this, either in DITA itself or with JS?

Thanks.

Re: Bypassing missing images without being visible in output

Posted: Wed Nov 02, 2016 6:37 pm
by xephon
Hi John,

maybe you could use a Schematron rule to check the href value and force the user by error message/quickfix to set the required filter attributes on that element. Would that help?

Greetings,
Stefan

Re: Bypassing missing images without being visible in output

Posted: Wed Nov 02, 2016 7:47 pm
by John McGowan
Hi Stefan,

Maybe I wasn't clear.
I want to make it possible to bypass the link error, so that it is not visible in the output.
For example, if I have a doc with several flavors, and I only want to include the image in two flavors, but I want to have the link in all flavors, then I need to be able to do that without getting the ubiquitous red cross in the output when it couldn't locate the image.
Also, I do not want to do it with conditionals for all flavors and languages.
Tricky one, I know :)

Re: Bypassing missing images without being visible in output

Posted: Thu Nov 03, 2016 5:48 pm
by alin
Hello,

You can try to use the following JS code:

Code: Select all


$(".image").error(function(){
$(this).hide();
});

The procedure of inserting custom content into the output HTML files can be found at:

Re: Bypassing missing images without being visible in output

Posted: Fri Nov 04, 2016 1:21 pm
by John McGowan
Thanks Alin.
Can this be added directly into the processing instructions?

Re: Bypassing missing images without being visible in output

Posted: Fri Nov 04, 2016 2:40 pm
by alin
John McGowan wrote:Thanks Alin.
Can this be added directly into the processing instructions?
What do you mean by that? Can you give me an example?