Firefox screenshots enlarged by display scaling

Changed

Context

When I upload a screenshot, it appears larger than the original size.

Discovery

By default, firefox adjusts device pixel sizes using your OS's display scaling.

Other screenshot tools on linux do the same.

With mine set to 125%, the screenshots are getting enlarged by that amount.

There is a setting, layout.css.devPixelsPerPx, defaulting to -1.

Setting this to 1 will ignore device scaling, but sites will be scaled down.

Another suggestion was to use the responsive preview with scaled down dpr, but this did not work.

Firefox console screenshot command

Firefox has a console command for screenshots: :screenshot --dpr 1.

This takes a full screenshot of the viewport.

Use --fullpage to get the entire page, or --selector for an element.

There is a bug for some selectors not working: https://bugzilla.mozilla.org/show_bug.cgi?id=1482807

More firefox screenshot bugs: https://bugzilla.mozilla.org/showdependencytree.cgi?id=1483143&hide_res…

Replacing files

Documentation

Uploaded file management

Drupal core

Uploaded files are impossible to replace

File Field Paths

View on Drupal.org #3069511Replace Existing Files Status: Needs work

View on Drupal.org #3069511File entity update is allowed only for user who has uploaded the file Status: Needs work

Orphaned file deletion

There is an old change record (2017) to no longer clean up unused files.

There is a config setting, file.settings.make_unused_managed_files_temporary, to revert the change.

However, for media embedded in wysiwyg, it seems the usage never goes down to 0.

Issues

View on Drupal.org #2821423Dealing with unexpected file deletion due to incorrect file usage Status: Active

View on Drupal.org #3364744Add a reliable entity-usage system to core Status: Active

View on Drupal.org #3427640Deleting an entity with revisions and file/image field does not release file usage of non-default revisions, causing files to linger Status: Active

View on Drupal.org #3427640File not marked temporary and usage not updated if only used in past revisions when node is deleted Status: Active

View on Drupal.org #2982556Image should be removed from the folder Status: Needs work

View on Drupal.org #3350697File "in use" does not get set to "0" after being removed from content Status: Active

View on GitLab #3160322File usages referencing deleted entities should be reported and made deletable Status: Active

View on Drupal.org #2743345Revisions should be individually deleted when deleting entities Status: Postponed

View on Drupal.org #3027324[PP-2] When Media entities are deleted, the associated files are not deleted Status: Needs work

View on Drupal.org #3367368Merge the functionality of Media File Delete into the core media system Status: Needs work

View on Drupal.org #3059494File usage is not tracked by revision, leading to private files embedded in text fields in old revisions being accessible when they shouldn't be Status: Active

View on Drupal.org #3123244Instead of relying on file usage, tracking dependency to determine the deletion of files Status: Active

View on Drupal.org #3232414Image Media thumbnail alt text cannot be changed without reuploading the image Status: Needs work

modules

View Media Files Handler on Drupal.orgMedia Files HandlerCovered by the Drupal security advisory policy (15 installs)

View Audit Files on Drupal.orgAudit FilesCovered by the Drupal security advisory policy (5,758 installs)

Analysis

This appears to be a widespread issue with OS screen scaling, and how applications use them.

The most reliable fix is to set the display scaling to 100% before taking screenshots.

Done

Added UI Scaler for HiDPI screens applet for faster switching.

Added View CKEditor Media Edit on Drupal.orgCKEditor Media Edit (43 installs), and View Media Entity File Replace on Drupal.orgMedia Entity File ReplaceCovered by the Drupal security advisory policy (24,680 installs) modules to help replace files in ckeditor media.

TODO

Adjust existing screenshots.

Test again with wayland or future versions of linux mint.

Try Media Files Handler, Audit Files modules.

Related tasks