unlcms / project-herbie

Drupal 10 implementation at the University of Nebraska–Lincoln
https://cms.unl.edu
GNU General Public License v2.0
5 stars 6 forks source link

Object-positioning of hero/display banner images #589

Closed skoolbus39 closed 4 months ago

skoolbus39 commented 6 months ago

I found the culprit for object-position not working in hero/display banner images: dcf-ratio and dcf-ratio-16x9 cannot be sibling classes:

Screen Shot 2023-10-27 at 3 10 07 PM

I know that applying classes directly to images has proven tricky, but in order for ratio, object-fit and object-position styles to work correctly, these styles need to be applied directly to the <img>. This likely means recreating these styles as CMS-specific CSS.

The image itself will need styles for:

The image's parent will need the dcf-ratio class (no need for custom CSS).

11/07/2023 - Saron I talked to Ryan and decided that we would need the parent of the image to have these classes - dcf-ratio dcf-ratio-16x9 and that image should include these classes - dcf-ratio-child dcf-obj-fit-cover (vertical positioning classes)

acoleman commented 6 months ago

@sarongebre On my local installation (https://cms-local.unl.edu/admin/structure/media/manage/image/display/) - then clicking on the image outputs and then editing each respective image it looks like there is a field for adding additional classes. Would this solve the issue if we could add them in that box, then somehow inject the "dcf-ratio" class in the parent div?

I'm not sure how we would handle all the different possible object-position variations other than adding additional outputs, for instance: Full - Widescreen - Top Full - Widescreen - Right Full - Widescreen - Bottom Full - Widescreen - Right Top (and so forth).

I admit to not knowing a great deal about the media module and image outputs, so I apologize if the above comment is naive to how it works.

sarongebre commented 6 months ago

Yeah, those are different view modes created for the image media type. We could add the classes in the views. As you said, if we want to add object-position variation, we would have to do it like you explained above. I meant to talk to Eric about this once to see what he thinks about this approach. I think mentioning this at our standup meeting might be a good idea. It's tricky, but I am also looking into programmatic ways to achieve what we are trying to do.