Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make add_image/ggplot responsive in Outlook #304

Open
caldwellst opened this issue May 4, 2023 · 0 comments
Open

Make add_image/ggplot responsive in Outlook #304

caldwellst opened this issue May 4, 2023 · 0 comments

Comments

@caldwellst
Copy link

caldwellst commented May 4, 2023

Outlook does not typically support max-width and responsive design. However, there is a workaround highlighted in this SO post. My current email tasks are almost entirely going to Outlook users, and I wanted to use blastula::add_image() and blastula::add_ggplot(), but the output is not ideal for Outlook (on Windows machines in particular).

However, with a simple wrapper on the end of those functions, I stripped out the HTML output and replaced it with the solution that allows for responsive image viewing in Outlook for Windows. I essentially convert:

<table width="100%" align="center">
  <tr>
    <td>
      <img src="image-path" alt="" width="520" style="width:520px;"/>
    </td>
  </tr>
</table>

into:

<table border="0" cellspacing="0" width="100%">
  <tr>
    <td></td>
    <td width="520">
      <img src="image-path" alt="" width="520" style="display:block;width:100%"/>
    </td>
    <td></td>
  </tr>
</table>

You essentially vary the alignment by leaving out cells. While it's a bit hacky, I believe it's a very valuable solution to have for emails with significant numbers of recipients using Outlook.

Could this be added to blastula itself? It could be an additional parameter to add_image() and add_ggplot() to return this, or a separate function entirely? If agreed, happy to help implement in the source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant