Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on implementation of SVG-Images from Wikimedia Commons #385

Open
LibrErli opened this issue Apr 9, 2024 · 2 comments
Open

Error on implementation of SVG-Images from Wikimedia Commons #385

LibrErli opened this issue Apr 9, 2024 · 2 comments
Assignees
Labels

Comments

@LibrErli
Copy link
Contributor

LibrErli commented Apr 9, 2024

E.g. ZHB Luzern retrieves as example image the logo image stored as *svg on Wikimedia Commons. It seems that the lobid-imageproxy has troubles with implementing svg correctly.

@dr0i
Copy link
Member

dr0i commented Apr 15, 2024

The image seems to be of type PNG:

$ curl -L 'https://commons.wikimedia.org/wiki/Special:FilePath/ZHB%20Luzern%20Logo%20farbig.svg?width=270' -o image
$ file image
image: PNG image data, 270 x 60, 8-bit colormap, non-interlaced

But lobid's imagesproxy tries to parse it, based on the file's name, as SVG - which consequently fails.

What we can do: change the imagesproxy to:
a) determine type of image by taking the content-type header into account (and not just by parsing the URL to determine get the file's suffix)
b) get rid of all HTML parameter (?.*) - that would leave us with curl -L 'https://commons.wikimedia.org/wiki/Special:FilePath/ZHB%20Luzern%20Logo%20farbig.svg which is a SVG

As a hip-shot I would say b) is easier to do, but then we might not fix all scenarios. On the other hand, a) may also be problematic, if not all images have a content-type header. (b) could also be just a fallback if a URLs path is not ending with a dot + three characters (aka file extension).

@acka47
Copy link
Contributor

acka47 commented Jun 4, 2024

What is the status of this, @Phu2 @dr0i ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants