Skip to content

Commit

Permalink
better way to transform images to raw
Browse files Browse the repository at this point in the history
  • Loading branch information
JBGruber committed Jan 16, 2024
1 parent 18c9fcf commit 1f55c8d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions R/utils.r
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ com_atproto_repo_upload_blob2 <- function(image,
img <- magick::image_read(image)
image_mimetype <- paste0("image/", tolower(magick::image_info(img)$format))

# TODO: find way to do this directly
tmp <- tempfile()
magick::image_write(img, tmp)
img <- readBin(tmp, "raw", file.info(tmp)$size)
# transform to raw. Thanks Miff! https://stackoverflow.com/a/77824559/5028841
img <- magick::image_write(img)

httr2::request("https://bsky.social/xrpc/com.atproto.repo.uploadBlob") |>
httr2::req_auth_bearer_token(token = .token$accessJwt) |>
Expand Down

0 comments on commit 1f55c8d

Please sign in to comment.