INGInious icon indicating copy to clipboard operation
INGInious copied to clipboard

Support for SVG in get_imageblock

Open tbarbette opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. get_imageblock does not support svg.

Describe the solution you'd like Calling get_imageblock("something.svg") would display the svg.

Describe alternatives you've considered I'm displaying PNG, but it's big and ugly and pixellised. I'm telling my students I'll shoot them on sight when I see bitmap formats for graphs, so it would be great to follow my own rule :p

Additional context Maybe just adding format=svg+xml would work. Or avoid the base64 encode for SVG as it's XML in the content? I guess this is a good first issue...

tbarbette avatar Sep 29 '22 09:09 tbarbette

A workaround could be to use the reST directives .. image:: [image.svg] or .. figure:: [image.svg] instead.

See concrete usage in the following course: https://github.com/loan181/INGInious_memoire/blob/master/Introduction_IA_KNN/counter1/task.yaml#L9 https://github.com/loan181/INGInious_memoire/blob/master/Introduction_IA_NN/introNetwork/task.yaml#L16 https://inginious.org/course/reseaux-neurones/introNetwork

But maybe the get_imageblock() deals with specific use-cases that are not covered by the aforementioned directives ?

ClemCordier avatar Nov 18 '22 14:11 ClemCordier

Indeed, it is designed to return submission-specific generated images to the feedback, for instance, the result of an image processing algorithm designed by the student.

The only way to get rid of these limitations is to allow files to be returned in feedback, but it is not really a "Good First Issue".

anthonygego avatar Nov 18 '22 14:11 anthonygego