nychealth/EH-dataportal

Revise image handling

Closed this issue · 7 comments

save resized images to original folder, then point to resized image

This makes me wonder where we should really store images.

The banner images are all in story-specific folders, but it would be DRYer to keep them in static/images and use .params.image to have an absolute reference to the image url. We do re-use a lot of images - very few are specific to a data story (and we could keep those in the page bundle - the content folder).

I changed this issue title to be more general. Let's address two things:

  • resize header / card images (CG)
  • Change data story images - keeping them in static/images and updating the reference to the banner image
  • Give images descriptive names (for seo)

This might be a reach but is there any way that this merge may have affected the search? Entering a search term yields nothing but this console error - a baseURL issue

image

+, Add a conditional statement, with a default image, to image references (index.html template, data stories section and single templates, and anything else relevant) so that when new content is created, if it doesn't have an image and image reference, builds will still complete.


Hey @cgettings, I started establishing a default image that gets overridden if .Params.image is specified, for data stories. That way we won't have build errors prior to adding an image. But, I'm running into an issue involving .Resize code. I think this only works if it's called on a Resource, rather than a string, and I'm having a hard time either doing that to a site-level resource (the default image), or converting strings to resources. I've tried unsuccessful things that I won't commit - using conditionals, with, Scratch, and other approaches to manage the logic but keep on running into one issue or another. I don't want to ditch use of Resize altogether, since it's especially important on the home page, key-topics, and data-stories section pages (where we're loading thumbnails). Not sure how to get this working though.

this is currently on hotfix-ds-default btw.

Closed to consider dealing with later.