The CDLI is developing a new website. That website’s admin interface for its journals contains a page where a LaTeX source file, following a specific template, is configured to an HTML page. For this, apart from the LaTeX file itself, two additional components are needed: a BibTeX file, containing metadata of the references; and image files.
Current implementation
The current implementation involves uploading images separately from the form that creates the article. This can lead to “orphan” images if such a form is abandoned after uploading the images. The current implementation has an additional problem, where files are saved in a single directory, so multiple images with the same file name (say, Figure1.jpg
) will overwrite previous images.
New implementation
With a new implementation of the rest of the forms, simplifying a lot of the code, the issues with the image uploads are also attempted to be resolved.
Saving images together with the metadata
To avoid the problem of the “orphan” images resulting from abandoned forms, one could submit the images in the same form that creates the article. If that form is not submitted, or contains invalid data so cannot be saved, the images will not be uploaded.
Saving images according to metadata
The second problem could be solved immediately by saving the images in subdirectories according to the metadata of the image, e.g. 2021-01/
where 2021
is the year the article is published and 01
is the article sequence number within that year. This however assumes that that metadata does not change after the initial submission.
Both these solutions however creates some constraints on other problems, because it means that the images can only be saved after the user submits the main form, so after the HTML containing <img>
elements with references to the image locations is generated. Somehow, those image locations should be able to identify the article, before any information about that article is known:
So, what is the solution? I propose the following:
No comments:
Post a Comment