Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295102

Adjust custom navigation logo dimensions on upload

$
0
0

Problem/Motivation

Navigation allows to upload a custom logo to be included at the top of the bar.
Nowadays, the only restriction applied is related to image weight, but not for dimensions. That means that image bigger thatn te expected placement are being adjusted via CSS.

For a better resource management, would be great to adjust the custom logo dimensions to the logo placeholder to avoid loading unnecessarily big images.

Proposed resolution

The proposal here is to use a similar approach as we already have when uploading a picture to an image field that exceeds the maximum allowed size for the field.

When image is bigger than 40x40px, it would be automatically scaled during upload and a message like this would be shown to the end user:
The image was resized to fit within the navigation logo expected dimensions of 40x40 pixels. The new dimensions of the resized image are 40x40 pixels.

Following this path, code would be much simpler, reducing the number of possible points of failure and we would be safer assuming that original image can be used directly as navigation logo.

To give more flexibility, the icon size could be set as properties in the navigation.settings config entity, but not shown. So contrib modules or advanced site administrators could modify them.

Remaining tasks

None.

User interface changes

Adds message during file upload to notify user the image will be automatically resized if above expected size.

API changes

Adds image width/height as Configuration (no UI additions for these). For flexibility around image sizes changes tied to config rather than code, same as current file-size restriction already.

Data model changes

Uses Configuration to establish expected size of navigation logo.


Viewing all articles
Browse latest Browse all 295102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>