-
Notifications
You must be signed in to change notification settings - Fork 180
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
Resize image files on perseus file export #4416
Comments
Hi @rtibbles. I would like to work on this issue. Could you please assign it to me if possible? |
Hi @KshitijThareja - yes that would be fine - note that most of this should be relatively straight forward, but the edge case handling of the last item in the checklist is where it will be trickier (as it will require more interaction between the image resizing code and the code that is outputting the JSON data). |
Hey @rtibbles. I have a fair idea of what my approach should be. I just had one question. How do I test my changes? I am unsure if I can add a studio channel (from my local) containing a sample exercise to kolibri for testing it. And in studio itself, there's no preview available for the exercise. |
It is possible to install a channel from your development Studio. You can either override the STUDIO url to use your development server on Kolibri using this environment variable: KOLIBRI_CENTRAL_CONTENT_BASE_URL or add it as another server. I think it would also be a good idea to write some python unit tests for this code. |
Hey @rtibbles! What's happening is when kolibri downloads the data for a specific channel, the data that is downloaded (the sqlite database) does not conform to the original database that should have been fetched, thereby giving a SchemaNotFound error. I am unsure how to proceed with this. Could you please double check this from your end? |
Hrm, it should be configured to serve the files via a redirect: https://github.com/learningequality/studio/blob/unstable/contentcuration/contentcuration/dev_urls.py#L76 Can you post the SQlite database for the channel here as an attachment? You should be able to download it from |
Yeah sure. Here's the Link. |
Hrm, I wonder if the redirect is causing issues when downloading, and hence causing the empty file. Just to confirm, if you go to this URL: If in a python shell you do:
Does it print the binary content of the file? |
Yeah, it does. I had checked it out earlier too. |
Hi @rtibbles! |
Can you confirm what you're setting your CENTRAL_CONTENT_BASE_URL to? |
I have set it to work with my local development server. The value is set to: |
Just in case there's a silly bug at play, could you try adding a trailing slash to the end? |
I tried that, still getting the same error. I wonder if it's the same for everyone, or if it's some misconfiguration from my end. |
The only other thing I can think of is that somehow the CENTRAL_CONTENT_BASE_URL is not properly getting used to fetch the channel database, and instead, it's attempting to fetch from Studio (so a bug in Kolibri). Could you try adding the address as a "Peer import server" through the UI instead, and see if that works? |
Hi @rtibbles |
I will test locally and see if this is a more systematic issue, or if there is some configuration that is still missing for you! |
@KshitijThareja would you like to return to this or should we unassign? I just checked with @rtibbles and it seems it should be possible to continue if you'd like to:
|
Hi @MisRob! |
Thanks @KshitijThareja and no pressure at all, take all the time you wish (I'm just doing my regular status and clarification rounds :) |
Hi @MisRob, @rtibbles! |
Hi @KshitijThareja, good to hear from you :) No pressure, thanks a lot! |
@KshitijThareja Hi Kshitij, seems this is on hiatus, but just in case you'd return to it, note that we will be closed from December 23 to January 5. |
Hi @MisRob! |
Observed behavior
Currently when inserting images into the answer section of a multiple choice question that gets exported into a Perseus format, if the images have been resized they have height and width dimensions attached to them, similarly to how they are annotated in the question block.
Unfortunately, Perseus ignores the height and width annotation when images are inserted into the answer section (rather than the question section).
Additionally, this also means that if someone inserted a very large image and then resized it to be significantly smaller, we would be shipping a much larger image than is necessary in the bundled perseus exercise.
Expected behavior
During the backend process to create a perseus exercise bundle, we should resize any images that have been resized, in order to bundle them at the appropriate resolution. This will solve both of the issues above.
User-facing consequences
This will fix several user reports of image insertion into answers that have not been properly resized in Kolibri, and also save our users valuable space!
Acceptance criteria
create_perseus_zip
function - this could be done as a dict mapping from the image file name to the dimensionsThe text was updated successfully, but these errors were encountered: