How to link an image file in xml

Dear all, (including @asmecher, @ctgraham, @Vitaliy, @ajnyga)
I am using OJS 3.0.2
I have been working hard to publish in xml format and let the eLens do the rest of the job of viewing it.
I have so far been successful in getting what I had planned.
I have a problem of linking the image.
Here is my link of what I have done so far: Management of Dysgeusia related to Cancer | Journal of Lumbini Medical College

My problem is: I am not able to link image1. I have uploaded the image1.png file in submission. I have written the code as “graphic xlink:href=“image1.png”/” (tags brackets in place of “”) in my xml file. I have even copied the image1.png file from the submission folder of the corresponding article via cPanel into the folder where xml file is residing. But no luck. I still get a broken link.

How should i link image file in xml file?

Regards and thanking you all in advance.

1 Like

Hi @anupent,

We store images in a separate folder inside a web root, so we simple put a full link to it inside JATS.
@ajnyga has done some modifications to Lens Viewer to resolve this issue. You can try his Lens Viewer version: GitHub - ajnyga/lensGalley: Galley viewer plugin integrating eLife Lens for OJS 3.0: fork using the latest develop branch of Lens

1 Like

Thanks @Vitaliy,
I succeeded with your first suggestion to put images in a web accessible folder and put a full link to xml file.


The change I made to the Lens plugin was support for OJS based artwork files. In order to make those work, you need to apply a patch here: Allow artwork files for XML galleys by ajnyga · Pull Request #1353 · pkp/ojs · GitHub

After that patch you can add the images to the XML galley and IF the XML galley file has references to image files with the exact same name (just the file name, no path), the lensGalley plugin will rewrite those file paths and show the images you added to OJS. This is the same function as with HTML galleys.

The default setting in lensGally is that it will show images with full URL’s, so adding the images to another accessible folder and linking there will of course work. This was however something that I thought many editors will not want to do, or can not do.


Thanks @ajnyga,
I have applied the patch as described above.
Now, should i upload the image at submission phase or at any other point so that i can refer to that image in xml file with the exact same name (just the file name, no path)?


When you have added an XML galley file in the production phase, click the blue triangle in front of it and then edit. In the opened modal window you will find a grid where you can upload artwork files. It works the same with HTML files. That is a fairly hidden in OJS.

When you upload for example image1.jpg there and have a reference to the same filename in the XML galley file, both the embedGalley plugin and the lensGalley plugin should show the image.


Sorry to ping you guys here… May be someone of you can help. Do you know how can we include a <img tag in the XML file. If i do it doesnt get parse by JAT Vitely plugin

How to handle that? Because i want to display image in the article.

Hi @CreativeBoot,
See the codes below:

<fig id="fig1" position="float">
  <label>Fig 1</label>
  <caption><title>Examination of palatal myoclonus</title></caption>
  <graphic mimetype="image" xlink:href="fig_1.jpg" xlink:type="simple" />

Here, you should upload an image file “fig_1.jpg” as an attachment to the XML galley file.

Best regards,

Cant it use a full link?

You can. But relative links would be more convenient. Its up to you to use whichever you prefer.

If you use fulll link, I think you need to upload images to a certain folder and need to use the full link. And, you may need access to the server folderds to do so.

OK Thanks, let me try. But i want to host the images to some other CDN.

Hi @anupent

Thank you for your help. May I have one of the docx files that you successfully converted to JATS XML? I have a problem with parsing tables and figures.