Skip to contents

Note that WISEflow since spring 2024 does not accept inline images in import files. Instead, you have three options, ranked in order of increasing convenience:

  • Use only external images residing on someone else's web server, or no images at all.

  • Edit questions after import to WISEflow, copying images from your computer into the question editor. For R graphics output, this would involve manual knitting and then copying images. Make sure the output is deterministic, i.e. does not involve pseudorandom numbers.

  • Have library(examiner) copy images to a web server.

    • Make sure you can access the web server e.g. using WinSCP or Filezilla Client. You might need to use VPN.

    • Set up passwordless ssh.

      • Generate a private-public key pair on your local computer. I suggest using the default filename (id_rsa and id_rsa.pub, or id_ed25519 and id_ed25519.pub) and no passphrase.

      • Copy the public key (the .pub file) to ~/.ssh/ on the web server. Set appropriate permissions on the .ssh folder and key file, see the chmod part of the guide linked above.

      • Verify that passwordless ssh works by running the following in a terminal:

        ssh username@server.example.org pwd

        replacing server.example.org with the web server name and username with your username on that server. The pwd command should print your working directory on the server, typically something like /home/username.

      • Verify that secure copy works by running the following in a terminal:

        echo Test > test1234.txt
        
        scp test1234.txt username@server.example.org:~
        
        ssh username@server.example.org cat test1234.txt

        adapting the username and server name as above.

        The echo ... > ... command creates a small text file. The scp command copies the file to your home directory (~) on the server. The ssh command connects to the server and prints the contents of the copied file.

    • Figure out which folder on the server is served to the web. It might be ~/public_html.

    • Figure out what URL the folder is served as. It might be something like https://server.example.org/~username/.

    • Use this information to specify url_prefix and remote_dir to examiner::wiseflow_export_assignment().

With passwordless ssh and scp in place, the following should run successfully if you provide your own values for url_prefix and remote_dir.

rmds <- system.file(c("multiple_choice_question.Rmd", "multiple_penguin_question.Rmd"),
                    package = "examiner", mustWork = TRUE)
exam <- list("Test with images" = list("A section" = as.list(rmds)))
wiseflow_export_assignment(
  exam,
  filename = "From R markdown to WISEflow.json",
  url_prefix = "https://server.example.org/~username/dirname",
  remote_dir = "username@server.example.org:~/public_html/dirname",
  add_question_number = TRUE)