Updating mailer image from svg to png for Google#6892
Merged
Conversation
-- What Google proxies images that are sent in html emails that it receives in any of its clients. However, Google does _not_ support SVG images in html emails. This caused us some problems when attempting to send a mailer with an SVG image included, which worked in local testing (mailcatcher) but failed in a broader integration test environment (INT), 404'ing on Googles cached version of the image link. This commit provides a plain png rendering of the original svg and updates the relevant mailer template to display the png version. This should get us past the Google problem.
changelog: Bug Fixes, Asset Hosting, fixing svg image asset in mailer for Google proxying
zachmargolis
approved these changes
Aug 31, 2022
| <tr> | ||
| <td width="140"> | ||
| <%= image_tag('letter-warning.svg', width: 140, height: 140, alt: '') %> | ||
| <%= image_tag('letter-warning.png', width: 140, height: 140, alt: '') %> |
Contributor
There was a problem hiding this comment.
do we want to attempts any 2x versions of this image? or is too ambitious? 😜
Contributor
|
Ah, whoops, I should have caught this, since I encountered the same issue in my recent email template revisions. For future reference, this caniuse-like site is a great resource: https://www.caniemail.com/features/image-svg/ |
aduth
reviewed
Sep 1, 2022
Contributor
aduth
left a comment
There was a problem hiding this comment.
Two suggestions:
- Can we remove the now-unused
letter-warning.svgfile? - Can we move the PNG into
app/images/email, which was created for these assets, as a way to try to disincentivize using the raster version outside of emails?
Contributor
|
Looks like we could also losslessly reduce the size of the PNG by about 18% using a tool like Squoosh (OxiPNG). |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Google proxies images that are sent in html emails that it receives in
any of its clients. However, Google does not support SVG images in
html emails.
This caused us some problems when attempting to send a mailer with an
SVG image included, which worked in local testing (mailcatcher) but
failed in a broader integration test environment (INT), 404'ing on
Googles cached version of the image link.
This commit provides a plain png rendering of the original svg and
updates the relevant mailer template to display the png version. This
should get us past the Google problem.