我从Android应用程序获取数据,允许用户拍照并将其上传到服务器。
图像以JPEG格式存储在MySQL中。
我为每张图像获取以下数据。 ..
数据:图像/ JPEG; BASE64,/ 9J / 4AAQSkZJRgABAQAAAQABAAD / 2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P / 2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P / wAARCABkAGQDASIAAhEBAxEB / 8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL / 8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4 + Tl5ufo6erx8vP09fb3 + PN6 / 8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL / 8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3 + PN6 / 9oADAMBAAIRAxEAPwDl4LJZyo8zYWfbjjPbnr7 / AOecIbbygZFkZcDq3yk / TBOR70kMMjAOjqPn2jMoBB / E9PemTr5L7GwSePlYH9RxTJJPsT5Yb + jbQQpIORkc + lRFpEVoMjGckbR1 + tPijmO4x7jyF + Xvnt + l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uL6kUvP0FIBsgzG30qe3RjM0SyrEGUhixwpAGcfpx74qIelRqWZEUZGBj3JoAs3UAhXYJY5gybsxnI + H9 + Kbps4gu4ZWXIRwTnPFRywyxPsk4OAcexGR + hpqghNuepzmgB7ryyZz2yDUmnSmO5iYbRtbGXztAPHOO3NQbT / AH6RTtLJjHPX2oAu3FkscJf7TBIcD5VY5P8Anjr / AI1XhG8ou4Lk4yeg + tJtHB3ZyPyoQAZXNAFyPT55FyGgx7zoP5miqYopDFWIEBiuQeKbdKqQgqADnGRVhLpvsoty6eWH3DgZzjHXrj2qC6kVoAoIJDZOPSmIbbrJJsjUMznCqqjk + gFXZdOu7aFZrm1lijZtoLqRz + P + evpVCPhck + n8qlWVR3oQDAfmdSOh4PtSKPxPP86Ac3LEfdI60pTrjuc / ypAWbt4pQJRNPLMx + Yy88Y45zzj1qtSbD2H5mk2t6D86Bj / xpjkbh78UoVu4H / FX / wBagqTjpwaBFu2ezCFbpH3bgwZOpHocnGPwzz1qseoweaCCSTlcn1pCp6ggH6UASMoB5yM88UU0hmOcrz7UUDGeS + EI / wDfX / 1qXySRglQKsYzSAce9MRD5TbQu5ePUUCI / 7P5f / XqXvkfpR / OgCNU2sTn8BS08Y7ZpMc0gG0d6WigYmAKB1o + lKOvvmgBOv40UoFJ0oATHoDRSiigCSk7Z96KKYhScqzGm9ce9FFIBF6E + lOAyeaKKBje9Oxzj2oooAbijtRRQAUlFFAC44ooooA / / 2Q ==
当我以闪亮的方式呈现它时,我只获得每行的空白模板,而pic没有加载。
我不确定是否应删除初始标签
data:image/jpeg;base64,
只获得图片......但不确定它是否会有所帮助。
我在renderUI中渲染图像的当前代码如下:
title = HTML(paste0("<div class='image-wrap'><img src='./images/",
ps()$img[ps()$image_path == i],
"'class=fixed-height'",
ps()$img[ps()$image_path == i],
"'></div>"
))
当我渲染本地存储的jpeg图像时,相同的代码效果很好。
这是我第一次使用图片,我不确定给定的细节是否足够。
答案 0 :(得分:1)
我不确定这是否是你想要的,但是如果你只想将给定的编码图像输出到网页,那么你可以简单地使用该base64字符串作为一个src
属性。 <img>
标记。以下是开始使用的示例:
library(shiny)
imageData <- "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCABkAGQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDl4LJZyo8zYWfbjjPbnr7/AOecIbbygZFkZcDq3yk/TBOR70kMMjAOjqPn2jMoBB/E9PemTr5L7GwSePlYH9RxTJJPsT5Yb+jbQQpIORkc+lRFpEVoMjGckbR1+tPijmO4x7jyF+Xvnt+lNdGjYow2sMghh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0SyrEGUhixwpAGcfpx74qIelRqWZEUZGBj3JoAs3UAhXYJY5gybsxnI+h9+Kbps4gu4ZWXIRwTnPFRywyxPsk4OAcexGR+hpqghNuepzmgB7ryyZz2yDUmnSmO5iYbRtbGXztAPHOO3NQbT/AH6RTtLJjHPX2oAu3FkscJf7TBIcD5VY5P8Anjr/AI1XhG8ou4Lk4yeg+tJtHB3ZyPyoQAZXNAFyPT55FyGgx7zoP5miqYopDFWIEBiuQeKbdKqQgqADnGRVhLpvsoty6eWH3DgZzjHXrj2qC6kVoAoIJDZOPSmIbbrJJsjUMznCqqjk+gFXZdOu7aFZrm1lijZtoLqRz+P+evpVCPhck+n8qlWVR3oQDAfmdSOh4PtSKPxPP86Ac3LEfdI60pTrjuc/ypAWbt4pQJRNPLMx+Yy88Y45zzj1qtSbD2H5mk2t6D86Bj/xpjkbh78UoVu4H/fX/wBagqTjpwaBFu2ezCFbpH3bgwZOpHocnGPwzz1qseoweaCCSTlcn1pCp6ggH6UASMoB5yM88UU0hmOcrz7UUDGeS+ei/wDfX/1qXySRglQKsYzSAce9MRD5TbQu5ePUUCI/7P5f/XqXvkfpR/OgCNU2sTn8BS08Y7ZpMc0gG0d6WigYmAKB1o+lKOvvmgBOv40UoFJ0oATHoDRSiigCSk7Z96KKYhScqzGm9ce9FFIBF6E+lOAyeaKKBje9Oxzj2oooAbijtRRQAUlFFAC44ooooA//2Q=="
ui <- fluidPage(
tags$img(src = imageData)
)
server <- function(input, output, session) {
}
shinyApp(ui = ui, server = server)
答案 1 :(得分:0)
好的,我找到了这个问题的答案here。当我将搜索字符串更改为包含base64时,我偶然发现了这一点。