R/Img64Encoding.R

Defines functions Img64Encoding

Img64Encoding <- function(g, height = 35, fromfile = TRUE) {
	
	
	# Convert graphic .png-file 
	if (fromfile == FALSE) {
		
		# Create a temporary png file and open that file for .png structured output.
		# to add the grapic output to the file. Close file.
		png(gtemp <- tempfile(fileext = ".png"))  
		print(g)  
		dev.off() 
		
		sprintf('<img src="%s" height="%f"/>', knitr::image_uri(gtemp), height)
		
		} else {
	
	sprintf('<img src="%s" height="%f"/>', knitr::image_uri(g), height)

	}
}
irisweyermenkhoff/toyota-idv-functions documentation built on March 4, 2020, 9:57 a.m.