rstudio / blastula

Easily send great-looking HTML email messages from R
https://pkgs.rstudio.com/blastula
Other
547 stars 85 forks source link

Format Images inside Rows #326

Open Amaru6 opened 9 months ago

Amaru6 commented 9 months ago

Hi there,

I'm reporting the following situation I encountered when I tried to include images in my gt table for reporting:


# From: https://gt.rstudio.com/reference/local_image.html

dplyr::tibble(
  pixels = px(seq(10, 35, 5)),
  image = seq(10, 35, 5)
) |>
  gt() |>
  tab_header(
    title = "A1",
    subtitle = "A2"
  ) |> 
  text_transform(
    locations = cells_body(columns = image),
    fn = function(x) {
      local_image(
        filename = test_image(type = "png"),
        height = as.numeric(x)
      )
    }
  ) |> 
  as_raw_html() -> prueba

correo_gnrl <- get_business_outlook()
mail_temp <- compose_email(md(prueba))
correo_gnrl$create_email(mail_temp,
                         to = "blablabla@sth.com",
                         send_now = TRUE)

This results in:

image

Which means I can't control the size of the images. In a real scenario this would mean that the email would not look appropiate for reporting purposes.

Am I missing something or is this a bug?

Thanks in advance.

> sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=Spanish_Peru.utf8  LC_CTYPE=Spanish_Peru.utf8    LC_MONETARY=Spanish_Peru.utf8
[4] LC_NUMERIC=C                  LC_TIME=Spanish_Peru.utf8    

time zone: America/Lima
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] blastula_0.3.4      gt_0.10.1           Microsoft365R_2.4.0

loaded via a namespace (and not attached):
 [1] jsonlite_1.8.8    dplyr_1.1.4       compiler_4.3.2    tidyselect_1.2.0 
 [5] Rcpp_1.0.11       xml2_1.3.6        stringr_1.5.1     fastmap_1.1.1    
 [9] mime_0.12         R6_2.5.1          commonmark_1.9.0  generics_0.1.3   
[13] curl_5.2.0        tibble_3.2.1      pillar_1.9.0      rlang_1.1.2      
[17] utf8_1.2.4        V8_4.4.1          stringi_1.8.3     fs_1.6.3         
[21] sass_0.4.8        juicyjuice_0.1.0  cli_3.6.2         withr_3.0.0      
[25] magrittr_2.0.3    digest_0.6.33     rvest_1.0.3       rstudioapi_0.15.0
[29] base64enc_0.1-3   rappdirs_0.3.3    AzureAuth_1.3.3   lifecycle_1.0.4  
[33] vctrs_0.6.5       AzureGraph_1.3.4  glue_1.6.2        fansi_1.0.6      
[37] pacman_0.5.1      httr_1.4.7        tools_4.3.2       pkgconfig_2.0.3  
[41] htmltools_0.5.7