Feature: Crop variant and placeholder of a profile image 

Description 

Which crop of a profile image a view renders, and which placeholder stands in for a profile without an image, are site settings now. Until now a project had to copy the item and the detail templates to change either of them.

Setting Default Read by
plugin.tx_academicpersons.image.list.cropVariant default The list, list and detail, selected profiles and selected contracts elements, and the contacts of a page
plugin.tx_academicpersons.image.card.cropVariant default The card element
plugin.tx_academicpersons.image.detail.cropVariant default The public profile
plugin.tx_academicpersons.image.placeholder.mr, plugin.tx_academicpersons.image.placeholder.ms and plugin.tx_academicpersons.image.placeholder.diverse (empty) A profile of that gender without an image

square and portrait are the other crop variants the profile image offers, see The crop variants of the profile image. An empty value renders default. An image without a crop stored for the requested variant is shown uncropped, and so is every image for a name it does not define.

A gender placeholder wins over plugin.tx_academicpersons.image.placeholder.default for the profiles of its gender. An empty one, and a profile without a gender, fall back to the default placeholder. Every placeholder is an EXT: path to a public file, and a path that does not resolve fails the rendering.

TypoScript constants
plugin.tx_academicpersons.image {
  card.cropVariant = square
  placeholder.ms = EXT:my_sitepackage/Resources/Public/Images/PersonMs.svg
}
Copied!

The widths are not a setting: they come from the presets of the image partial of EXT:academic_base, see Changing the image markup.

Impact 

With the defaults every view renders what it rendered before.

A site that sets square or portrait shows an image uncropped, at its own ratio, until an editor crops it for that variant in the backend. That includes every image uploaded through the frontend editor of fgtclb/academic-persons-edit , which stores no crop area.

All content elements of this extension share one settings array, so the card template tells the item which view it renders: it passes imageView: 'card' to Partials/Profile/List/Items.html, which hands it on to Partials/Profile/Item.html and from there to the item image. A project copy of any of the three that predates this change does not hand it on, and its card reads the list crop variant:

  • A copy of Templates/Profile/Card.html adds imageView: 'card' to the arguments of Profile/List/Items.
  • A copy of Partials/Profile/List/Items.html adds imageView: imageView to both <f:render partial="Profile/Item"> calls.
  • A copy of Partials/Profile/Item.html that renders Profile/Item/Image with arguments of its own adds imageView: imageView to them.

A site that leaves the card crop variant unset needs none of that.

The contacts of a page of fgtclb/academic-contacts4pages follow the list crop variant and the gender placeholders, as they already followed the default placeholder.