WSDOT / wsdot-website

Codebase for WSDOT's public Drupal 7 website hosted on Acquia.
0 stars 4 forks source link

Add new content type field for open graph image #527

Closed waynedyck closed 3 years ago

waynedyck commented 3 years ago

Need to set a default image to use as well as create a separate image field to allow us to upload one of our choice. Also need to create a new image style which crops and resizes the uploaded image automatically to 1200 x 630.

That size is what Facebook recommends for the og:image tag.

waynedyck commented 3 years ago

I always forget image style images are created when first requested, not when the file is uploaded. You upload a full size image and then apply image styles when viewing them. In the case of the og:image image, there isn't necessarily a 'view'.

waynedyck commented 3 years ago

The Imagecache Token module appears to address this issue. The module provides additional tokens for image fields. For each image style available, a token [node:field_image_field:style_name] will be provided. It is also possible to get image properties like width or height by using tokens like [node:field_image_field:style_name:height].

Drupal 8 port The functionality has been merged into the Token module itself, so a separate module will not be needed for D8.