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

Adds embedded figure binaries in json upload #2016

Open
wants to merge 2 commits into
base: dev/31-taconite
Choose a base branch
from

Conversation

iturgeon
Copy link
Member

@iturgeon iturgeon commented Jul 10, 2022

Adds initial support for uploading obojobo module .json files
that can include image binary data in the json. Previously it
was not possible to import a json file with the images referenced
in it's chunks due to them referencing ID's in specific obojobo
instance they were being created on.

This change allows figure chunks to support a new content property
named 'imageBinary' that contains base64 encoded image data when
uploading via the dashboard in .json formatted modules.

This also provides a script that can be run against an existing
.json module on your local files and populate imageBinary for you.

It will will attempt to locate images by their content.filename
in the directory (or sub directory) of the .json module you provide

See embedFigureBinary.js for usage.

This change does not support embedding image binaries in xml formatted
modules and I have not tested support for uploading .json in the editor.

Adds initial support for uploading obojobo module .json files
that can include image binary data in the json.  Previously it
was not possible to import a json file with the images referenced
in it's chunks due to them referencing ID's in specific obojobo
instance they were being created on.

This change allows figure chunks to support a new content property
named 'imageBinary' that contains base64 encoded image data when
uploading via the dashboard in .json formatted modules.

This also provides a script that can be run against an existing
.json module on your local files and populate imageBinary for you.

It will will attempt to locate images by their content.filename
in the directory (or sub directory) of the .json module you provide

See embedFigureBinary.js for usage.

This change does not support embedding image binaries in xml formatted
modules and I have not tested support for uploading .json in the editor.

(cherry picked from commit 9cc4a4f7401709417807b5543effc031900ec315)
@iturgeon
Copy link
Member Author

The tests don't currently pass & I'm not sure exactly which branch to target, you'll have to let me know @FrenjaminBanklin

@iturgeon
Copy link
Member Author

To upload a json file with curl,

curl 'https://127.0.0.1:8080/api/drafts/new' \
  --compressed \
  --insecure \
-X 'POST' \
-H 'content-type: application/json' \
-H 'accept: application/json' \
-H 'Cookie: obo_next=SESSIONID' \
-d @<(jq '{"format": "application/json", "content": .}' < ./path/to/lo.json)

@FrenjaminBanklin FrenjaminBanklin changed the base branch from master to dev/29-sodalite August 26, 2022 20:13
@FrenjaminBanklin FrenjaminBanklin changed the base branch from dev/29-sodalite to dev/31-taconite March 21, 2023 17:24
@RachelDau RachelDau self-requested a review May 10, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant