rweekly.org icon indicating copy to clipboard operation
rweekly.org copied to clipboard

Images in R Weekly show up full size in my Gmail

Open luyongxu opened this issue 7 years ago • 22 comments

All the images that are attached to the R Weekly show up really big (too big) when I view the email in my Gmail.

luyongxu avatar Jan 29 '18 20:01 luyongxu

can you let us know which edition of rweekly you are referring?

tbs17 avatar Jan 29 '18 20:01 tbs17

This is the case for me also. I suspect there is some CSS on the site which does not translate to the emails.

screen shot 2018-01-30 at 7 31 04 am

jonocarroll avatar Jan 29 '18 21:01 jonocarroll

This has happened to every single R Weekly that I've ever received. But for a specific example, the tf-idf image in "R Weekly 2018-5 Interview, DataFramed - Weekly Updates from the R Community" is extremely big. Sorry I didn't include a screenshot.

I love reading the R Weekly. Please keep up the good work.

luyongxu avatar Jan 29 '18 21:01 luyongxu

Thanks for the report, we will resize the images to the same width in the future release.

qinwf avatar Jan 30 '18 01:01 qinwf

Images were good size in latest R Weekly. Thank you. Closing issue.

luyongxu avatar Feb 05 '18 17:02 luyongxu

Images are too big again in the latest issue.

image

luyongxu avatar Sep 10 '18 14:09 luyongxu

was this only a problem in one issue @qinwf? I'd like to close this if no action is required.

maelle avatar Sep 25 '20 11:09 maelle

This still happens for me in all of the rweekly emails. If someone on the rweekly team could outline how the emails are generated or point to the templates, I'd be happy to take a look (or it'd be useful information for someone else to tackle the problem).

gadenbuie avatar Sep 25 '20 23:09 gadenbuie

The email is sent by Google FeedBurner. The email will use the same image as the post.

If the post uses a small resized image in the post, and the email will use the small image.

We will add a tip for the editor to resize the large image before publishing the draft.

Thanks for the report.

qinwf avatar Sep 27 '20 09:09 qinwf

I tend to do this manually, but only after initially uploading the original size image then remembering to shrink it via gimp. It's a bit of a hassle and becomes dependent on an external tool.

Could we add a GitHub Action to resize new images in the rweekly/image repo to a maximum size (imagemagick or the R-wrapper thereof)? Would that change the URL?

Options from a quick search: https://github.com/marketplace/actions/image-resizer-inplace https://github.com/marketplace/actions/image-resizer-action

Another option would be a function (R, of course) to do this locally which:

  • takes a local image filepath and the path to the rweekly/image local clone,
  • resizes the image to a maximum dimension,
  • commits and pushes to rweekly/image,
  • returns the raw.githubusercontent.com link as a markdown link ready to be inserted into the draft.

I'm happy to prototype this option even if we decide to go with Actions. It could make inserting images that little bit easier. This is probably also the right time to start rweekly.tools.

jonocarroll avatar Sep 29 '20 04:09 jonocarroll

Watch this space! https://github.com/rweekly/rweekly.tools

jonocarroll avatar Sep 29 '20 04:09 jonocarroll

Awesome idea @jonocarroll! I use GIMP too for resizing and yes it's a hassle. :wink:

Are we sure the images that are re-sized to 800px width are ok in emails btw?

The raw link is not a permalink.

maelle avatar Sep 29 '20 05:09 maelle

The raw link is what we use in the issue, though, e.g. raw.githubusercontent.com/rweekly/image/master/YYYY-MM-DD/filename.png but for a moment I thought these files used hashes - I probably uploaded some files with autogenerated filenames.

The function would then do something like this (some defaults would be set):

upload_image(file = "image_for_this_issue.png", 
             caption = "image caption", 
             width = "800px",
             issue = "2020-10-05",
             image_repo = "../image", 
             push = TRUE)
* resizing to maximum width 800px
* issue not found in rweekly/image, creating 2020-10-05
* saving original and resized images to rweekly/image/2020-10-05/
* committing original and resized images to rweekly/image local repo
* pushing to rweekly/image remote
* converting link
Insert the following into the draft issue:
![image caption](https://raw.githubusercontent.com/rweekly/image/master/2020-10-05/image_for_this_issue_800px.png)

jonocarroll avatar Sep 29 '20 05:09 jonocarroll

The resized images are helpful and I really appreciate that you're tackling this. With very large (wide) images, it becomes almost impossible to read the email on mobile (which is how I read email, really).

I do wonder, though, if it would be possible to address this with CSS? For example if it's possible set a max-width on the image (or the email page) it may be possible to avoid the need for resizing. Plus 800px is much better than 1200px+, but it's still wider than a typical phone screen which is closer to 400px wide.

gadenbuie avatar Oct 01 '20 20:10 gadenbuie

@qinwf is there any way to add CSS to Google Feedburner emails?

maelle avatar Oct 02 '20 06:10 maelle

I resized images to 600px wide with a new function in rweekly.tools this week - the email images show up only ever so slightly larger than my screen width on mobile (Samsung Galaxy S10+) but that's presumably highly dependent on device.

CSS in the email would hopefully get us even closer, but how is this in the meantime? It should prevent extremely large images, at least.

jonocarroll avatar Oct 05 '20 20:10 jonocarroll

I will try using CSS, but I think it may not work. I will report the result in the wiki https://github.com/rweekly/rweekly.org/wiki/TODO:-Email-Images-Resizing

qinwf avatar Oct 09 '20 15:10 qinwf

@qinwf any update?

maelle avatar Nov 27 '20 13:11 maelle

This is still frequently a problem for me, as very often the R Weekly email is essentially unreadable on mobile. It's often due to large images but even with reasonable image sizes the unstyled Feedburner email is still difficult to read.

As a proof of concept, I tried blastula with the latest RWeekly email. You can preview the email here where you can see that it responsively limits image size and works well on both small and large screens. (For comparison, I've also uploaded roughly the current weekly email as I see it in gmail.)

Here's the source Rmd file with minimal changes from the .md file used in this repo. Alternatively, you could keep the .md file for the repo and use a separate script to build a better, more customized email body using compose_email(). But even the minimal version would be a huge improvement.

gadenbuie avatar Jan 25 '21 19:01 gadenbuie

@gadenbuie Sorry, you are still experiencing a problem with R Weekly email. We had a discussion recently about this issue and we are working on fixing it. Thank you for proposing multiple solutions 😊. We'll try to address the problem again this week.

BatoolMM avatar Jan 25 '21 20:01 BatoolMM

@gadenbuie Thank you for the example to send emails with blastula.

I will update the rweekly editing tool to resize images for the draft post this week.

I think GitHub Pages is simpler to build the website. Maybe we will not introduce an extra step to build the pages.

qinwf avatar Jan 28 '21 13:01 qinwf

This is the latest issue, with maximum zoom on by smartphone.

Screenshot_20220517-074228

privefl avatar May 17 '22 05:05 privefl