R/avatar.R

Defines functions avatar

Documented in avatar

avatar <-
function(base_hostname=NA,size=64){
  
  if(!is.character(base_hostname))
    stop("base_hostname must be a string")
   
  size_range<-c(16,24,30,40,48,64,96,128,512)
    
  if(!(size %in% size_range))
    stop("Avaliable values for size are: 16,24,30,40,48,64,96,128,512")
  
  url<-GET(paste("https://api.tumblr.com/v2/blog/",base_hostname,"/avatar/",as.character(size),sep=""))
  
  image_url<-url[[1]]
  
  return(image_url)
}

Try the tumblR package in your browser

Any scripts or data that you put into this service are public.

tumblR documentation built on March 18, 2020, 5:09 p.m.