bootstrapworld / curriculum

6 stars 7 forks source link

Image Infrastructure Update #1197

Closed schanzer closed 1 year ago

schanzer commented 1 year ago

The Problem

Demands on our use of images have grown a LOT since 2020:

Dorai has heroically extended the @image{...} directive with optional arguments this whole time. But each argument adds a layer of complexity and an opportunity for mistakes. (QUICK! What is the size and description of the following image: @image{images/box-n-whisker-plot.png, 300, "A sample box-and-whisker plot"} -- lmfao no ur wrong the caption is "300" silly!)

We've also accumulated some technical debt, with zero standardization on where image files live within a lesson. Sometimes they're in a dedicated images/ directory, but sometimes they're in the pages/ directory. And sometimes they're in both!

With the addition of image citations coming down the pike in 2023, it's time to address this problem.

Proposed Solution

[
  "box-plot.png" : {
        "caption" : "distribution of US Income in 2003"
        "description" : "a box plot showing a right skew"
        "source" : "retrieved from data.gov on April 15th, 2022"
        "license" : "Creative Commons 2.0 - ND - SA"
  },
  "red-star.png" : {
        "caption" : ""
        "description" : "an image of a solid, red star"
        "source" : "Created by the Bootstrap Team"
        "license" : "Creative Commons 4.0 - NC - SA"
  },
]

With this implementation, we can use CSS to ensure that empty captions aren't rendered. Screenreaders will always vocalize using the label first, then the description. Visually-impaired users will hear "distribution of US Income in 2003, a box plot showing a right skew". Sighted users will see the image, with the text "distribution of US Income in 2003, retrieved from data.gov on April 15th, 2022".


When including an image, we can just use the standard @image tag, with arguments solely for filename and size. The build script can compare the filename to the dictionary, and include proper captions, alt text, etc. It can also produce a warning if an image isn't in the dictionary. And finally, it could combine all the dictionaries into a single citation page for each pathway, allowing us to show exactly where every piece of media we use came from.

This has the benefit of backwards-compatibility: none of the existing @image tags need to change. Everything will still work! Over time, we can move all the captions out of those tags and into these dictionaries.

flannery-denny commented 1 year ago

@schanzer nudging you to add the following to the spec above:

flannery-denny commented 1 year ago

@ds26gte please implement this on the image branch so that I can confirm that my changes are working as expected. Thanks!

flannery-denny commented 1 year ago

@retabak @schanzer

flannery-denny commented 1 year ago

@schanzer is it intentional that the page "Do NYC Schools reflect the City's diversity?" was removed from the bar and pie chart lesson?

flannery-denny commented 1 year ago

Ninja Cat Images created for Bootstrap by Colleen Murphy

flannery-denny commented 1 year ago

@schanzer Flagging that the coordinates lesson includes images that are linked to with @link… not sure how this will work with the image infrastructure. Seems these could be pdfs instead of pngs linked to with @handout?

schanzer commented 1 year ago

@flannery-denny good call! I've implemented that change and pushed.

flannery-denny commented 1 year ago

@schanzer There are sometimes images that only exist in slides. Do we want to describe them, too? for an example, see functions for character animation, which only has one image, and it's only used in slides.

schanzer commented 1 year ago

@flannery-denny No need to describe them (this includes china-code.png in the defining values lesson)

flannery-denny commented 1 year ago

Does that mean we should leave them out of lesson-images.json or make a commented section of that file that says images only used in slides or list them in the file with "slides" in the 3 required fields?

schanzer commented 1 year ago

Leave them out.

(Also FYI - you can't add comments to a .json file)

flannery-denny commented 1 year ago

@ds26gte

@schanzer Thanks for agreeing to take on the computing needs all voices lesson. Encouraging you to also look at the comments I made in the comment with the checkboxes above about images I had questions about the provenance of, as I expect Dorai will also not know what to do about them.

flannery-denny commented 1 year ago

@schanzer @ds26gte Had a chance to check out the image branch. Here are some things I have questions about:

"dollar-infographic-mona-chalabi.png" : { "caption" : "Made by Data Designer @link{https://www.instagram.com/monachalabi/, Mona Chalabi}", "description" : "Infographic: For every dollar a white man earns... visual shows parts of dollar bills corresponding to the comparable earning of other groups including (from highest to lowest earnings): Asian Men, Asian Women, White Women, Black Men, Native American Men, Black Women, Hispanic Men, Native American Women, Hispanic Women", "source" : "https://www.instagram.com/monachalabi/", "license" : "Used with permission from the creator." },

flannery-denny commented 1 year ago

@ds26gte before we close this issue, let's add something about these files to the README doc, including wording standards for authors.