Importing Articles with Cover Images

Hello,

I recently worked on migrating a journal from an older self-coded platform to OJS3. Our editors would like to import all the older issues into our new OJS3-journal. So I was looking into the corresponding entry in the admin guide and the sample files provided there.

I couldn’t find any info on how to attach a cover image to an article in the sample files. However, the XML schema for OJS defines an element named cover (cf. lines 171-180):

<element name="cover">
	<complexType>
		<sequence>
			<element name="cover_image" type="string" minOccurs="1" maxOccurs="1" />
			<element name="cover_image_alt_text" type="string" minOccurs="1" maxOccurs="1" />
			<element name="embed" type="pkp:embed" />
		</sequence>
		<attribute name="locale" type="string" />
	</complexType>
</element>

Now I’m not the fittest when it comes to XML but I don’t quite get what the first element in the sequence does and what it should look like, but I understand it is required, right?

I tried to export already published articles that have cover images but the resulting XML didn’t feature them. And as expected, when I imported the XML file again, the articles where without covers.

Could you please give me an example of a well-formatted, OJS3-importable XML file of an article with a cover image (or an issue with many articles that each has a cover image) would look like? That would be really great!

Thanks in advance!

1 Like

Hi @1Name

It seems like article covers are still not considered in OJS native export and import.
Please track this GitHub Issue for changes/developments on that: consider article covers in native export and import · Issue #4294 · pkp/pkp-lib · GitHub.

Best,
Bozana

Thanks for your reply and opening the GitHub Issue, @bozana !

Do you know if there is any further documentation on the import/export formats? The admin guide and the example files don’t really provide a lot of information on what the single elements do and how they should be used to achieve desired results (such as the cover element, but also, for example, seq elements and attributes).

Maybe I should open another topic for that…

Hi @1Name

I think there is no comprehensive documentation, but a few example xml documents…
Please do not hesitate to ask, if something is not clear…

Best,
Bozana

Hi @bozana

Thankfully, the XML-import is not too strict and I managed to generate well(-enough)-formed and importable issue-files in a pretty straight-forward way :slight_smile:

However, my institution’s OJS installation didn’t respond well to neither a <covers> nor <cover> sub-element of <article>. This is the error message the system returns multiple times (once for each article in the issue, I guess):
Element '{http://pkp.sfu.ca}cover': This element is not expected. Expected is one of ( {http://pkp.sfu.ca}abstract, {http://pkp.sfu.ca}coverage, {http://pkp.sfu.ca}type, {http://pkp.sfu.ca}source, {http://pkp.sfu.ca}rights, {http://pkp.sfu.ca}licenseUrl, {http://pkp.sfu.ca}copyrightHolder, {http://pkp.sfu.ca}copyrightYear, {http://pkp.sfu.ca}keywords, {http://pkp.sfu.ca}agencies ).

I believe this is due to this installation’s native XML import/export plugin not yet featuring article covers, am I right?

Since I am only a journal manager in a multi-journal university-wide OJS installation to which I have no access, I wanted to ask:

  1. if you can give an estimate on when the changes proposed in your GitHub issue will be released in an updated version - or is it possible to update only the native XML import/export plugin to feature article-covers? If so, I could ask the installation administrators to apply the plugin update, which can probably more easily do than an entire system update.
  2. if you know of any other way to mass-import article-covers to already existing articles.

Thank You!

Hi @1Name

The next release containing that change will probably come in the second half of January.
If you need it earlier, your system admin could apply a patch with these changes:pkp/pkp-lib#4294 consider article covers in native export and import by bozana · Pull Request #2214 · pkp/ojs · GitHub.
Unfortunately, there is no other way to mass-import article covers…

Best,
Bozana

Hello @1Name,
I have worked out a working XML-file that imports external HTML-file along with their dependant images. Issue covers however is a problem, as they are only allowed in as a base64-encoded embed inside your XML-file.

Would you be interested in this?

In theory, without know your exact structure, you could export all of your articles into HTML and place images into a separate folder. Then link HTML as submission files, and images as supplementary files. All of them need a separate galley for import to work properly.

Th issue covers could be converted into base64 in you write up some sort of application in python / php / C# to build your XML-file. I use a custom XSD to generate a C# class that builds my XML, and then I use a Base64 conversion at the last step, as this generates a rather big load of text into the XML-file.

This is an example on how to convert an image to Base64,