seperate storage for quiz related images.
Is your feature request related to a problem? Please describe. Question related images should be stored in a separate directory/DB.
When creating a quiz question (multiple choice, for example) we put an image related to the question in the description field. Those pictures are stored in the course documents and are then also shown to users if that module is on. If you take away the rights for them to see them, then you can't see them in the quiz either.
- The description field will add unnecessary formatting depending on how the image is edited.
And the likes just an extra space e.d. - Reverences or images get lost if a course is deleted and those questions have been used in other quizes.
- Description field is handled like a text field (which it is) causing issues with test2pdf and possible other places
- Formatting issues and user errors. If a picture is added and not resized properly (or the option responsive) their test goes out of bounds on tablets and phones and hides the picture.
Describe the solution you'd like I purpose we make a separate optional field for an Image, where one can set one image per question. Which is linked irrevocably to that question. This resolves the above issues, but also allows uniform handling of images allowing for enhancements later on. (find all questions with images etc)
Good tip from @ywarnier
You can hide documents but enable their display in exercises by placing the documents as "visible" inside a folder that is invisible. This way, students cannot get into the folder, but direct access to the file is still allowed from within the course. For anyone reading this based on the above suggestion we now save all images into dedicated directory per course and hide it.
This is kind of a meta-issue that depends on other stuff to be implemented correctly. Developing a half-measure to enable separate storage for images would likely be generating more issues in the long run.
I'm increasing the priority on this one as it has become a more important problem with the (recently added) possibility to share questions between courses. Hopefully, the new system we use in Chamilo 2.0 will solve this automatically, but we'll have to check.
Quiz-related images should probably be considered resources and not assets (as they need contextual protection, as they can be security-critical)
Hi @ywarnier
The images added in the questions of an exercise, or in any content from the editor, in Chamilo 1.11.x are selected using the fileManager from the document resources. When an image is uploaded, it is first saved in documents and then selected and added as an img content in the editor. In Chamilo 2, currently images are being directly added to the content without adding them to documents because it doesn't have a fileManager yet. This task is being checked in #3795. However, when the fileManager is implemented, any image uploaded from there will be considered a resource and not an asset. Document files are resources in Chamilo 2. I believe this task can be closed since the fileManager is being reviewed in ticket #3795.
I added a fix about an error when creating a question in a quiz https://github.com/chamilo/chamilo-lms/pull/4757
This issue is still pending the completion of #3795 (next week), which should write files as an asset or a resource, depending on where (which object edition section) it is being embedded in.
The inclusion images to the different HTML Area fields of quiz / quiz question / quiz answer should register those images as resources with a link to the quiz / quiz question / quiz answer in the resource_link table.
When sharing the quiz / quiz question / quiz answer with another course, new links should be added in resource_link. When one of the shared versions of a quiz/question/answer is deleted, we should remove the corresponding resource_link records.
The behavior you've described is already implemented as specified. When images are embedded within the HTML fields of a quiz, question, or answer, they are registered as resources and linked appropriately in the resource_link and resource_files tables to the relevant quiz, question, or answer. This ensures that when these items are shared across courses, new links are created in the resource_link table to maintain the integrity of these resources across different contexts.
Furthermore, when a shared version of a quiz, question, or answer is deleted, the corresponding resource_link records are also removed to keep the database clean and prevent orphaned links. This implementation maintains a robust and flexible system for managing resources within quizzes and their associated questions and answers.
Looks all good indeed. Thanks for checking.