Skip to content

Troubleshooting local_image() #510

Description

@Worville

Hi,

I'm trying to use the local_image() helper to enter a .png file into a table.

If I try and create the path to the local image in my dataframe, then point local_image() to that path, I get an error of

"Error in file(con, "rb") : invalid 'description' argument"

Here's a minimum working (well, failing) example:

data <- data.frame(team_id = c(1, 22, 1),
                   stat = c(3, 4, 5)) %>% 
  mutate(logo_loc = str_glue('/path/to/image/{team_id}_logo.png'))

data %>% 
  gt() %>% 
  text_transform(
    locations = cells_body(columns = "logo_loc"), 
    fn = function(x) {local_image(filename =  as.character(x), height = 120)})

Any thoughts or advice?

Thanks a lot in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions