Replace data uri with actual image for default mosaic image #6435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subject
One day I was trying to read the output of
php bin/console debug:container --parameters
and I noticed that the output was unreadable due to a very long variable. The culprit wassonata.admin.configuration.mosaic_background
which contained about 22KB of base64 encoded PNG data as a data URI.This image is used as the default card background when displaying items in mosaic mode. It seems to me that this is not the most efficient way of embedding an image and it can be replaced with an asset and served using
{{ asset() }}
, much like the logo image.This PR makes this change while maintaining compatibility with
data:
URIs. The image added in this PR is the same as the original image in the data URI but optimized using tinypng.com, which reduced more than half the size.I have left the
isImageAvailable()
logic in theMetadata
class as it was, even though I think it can be improved.I am targeting this branch, because it is a backwards compatible change.
Changelog