oracle中base64字符串,将Base64编码的图像字符串转换为Oracle BLOB数据库(Base64 encoded image string into Oracle BLOB datab...

将Base64编码的图像字符串转换为Oracle BLOB数据库(Base64 encoded image string into Oracle BLOB database)

我的任务是获取base64编码的图像并将其作为blob存储到Oracle SQL数据库中。

我有base64编码图像的字符串,但它看起来不像是从sql数据库列blob导出的。

当我将数据库中的blob导出到xml时,它看起来像这样:

图像= “FFD8FFE000104A46494600010100000100010000FFFE003B43524541544F523A2067642D6A7065672076312E3020287573696E6720494A47204A50454720763830292C207175616C697479203D2039300AFFDB0043000302020302020303030304030304050805050404050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B101610111314 ....”

有谁知道这是什么转换? 或者这种转换在C#中是否可行?

非常感谢任何帮助,或者只是推动正确的方向也会很棒!

谢谢,

I am tasked with taking a base64 encoded image and storing it into an Oracle SQL database as a blob.

I have the string of the base64 encoded image but it doesn't look like what gets exported from the sql database column blob.

When I export the blob from the database into an xml it looks like so:

image="FFD8FFE000104A46494600010100000100010000FFFE003B43524541544F523A2067642D6A7065672076312E3020287573696E6720494A47204A50454720763830292C207175616C697479203D2039300AFFDB0043000302020302020303030304030304050805050404050A070706080C0A0C0C0B0A0B0B0D0E12100D0E110E0B0B101610111314...."

Does anyone know what conversion this is? or is this type of conversion possible in C#?

Any help is greatly appreciated, or just a push in the right direction would be awesome also!

Thanks,

原文:https://stackoverflow.com/questions/31091712

更新时间:2020-01-08 12:21

最满意答案

Image =以十六进制显示原始文件。

The Image= is showing you the raw file in Hexadecimal.

2015-06-27

相关问答

您可以使用以下正则表达式来检查字符串是否是base64编码的: ^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$

在base64编码中,字符集是[AZ, az, 0-9, and + /] 。 如果剩余长度小于4,则字符串用'='填充。 ^([A-Za-z0-9+/]{4})*表示字符串以0个或更多个base64组开头。 ([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|

...

下面描述的功能在NPM上可用 : var b64toBlob = require('b64-to-blob') atob功能将将base64编码的字符串解码为新字符串,其中包含二进制数据的每个字节的字符。 var byteCharacters = atob(b64Data);

每个字符的代码点(charCode)将是该字节的值。 我们可以通过使用.charCodeAt方法为字符串中的每个字符应用此字符串数组。 var byteNumbers = new Array(byteCharacters.

...

之前我提到过https://stackoverflow.com/a/14803292/1271826 ,它显示了一个相当有限的战术解决方案,解决了base-64字符串中+字符的存在问题。 这包括用%2B替换+字符。 但我注意到您还在参数中包含用户名和密码。 这表明你真的想要一个更通用的解决方案,逃避所有保留字符的百分比。 如果您不这样做,如果密码包含保留字符(例如+或& ),则无效。 提交这样的参数时,你应该百分之百地逃避这些值。 例如,您可以将字符集定义为仅“未保留”字符(由RFC 3986定义

...

这是编码的一种冗长方式。 我更喜欢这个: 您需要添加对Microsoft XML,v6.0(或v3.0)的引用 Sub TestBase64()

Dim bytes, b64

With CreateObject("ADODB.Stream")

.Open

.Type = ADODB.adTypeBinary

.LoadFromFile "c:\temp\TestPic.jpeg"

bytes = .Read

.Close

End Wi

...

我发现这不是我在base64解码中使用的函数。 相反,我拥有的值不是base64编码的字符串,而是base64编码dataURi,类似于 数据:图像/ JPEG; BASE64,/ 9J / 4AAQSkZJRgABAQAAA 所以我必须使用类似:clobbase642blob(substr(Photo,instr(Photo,',')+ 1)) 以下脚本的灵感来自Oracle Community的答案 DECLARE

l_param_list VARCHAR2(512);

l_http_

...

Internet Explorer和Firefox不支持WebP图像格式,目前还没有支持它的计划。 https://bugzilla.mozilla.org/show_bug.cgi?id=webp https://bugzilla.mozilla.org/show_bug.cgi?id=856375 编辑:无论如何,这个问题有完整的例子答案: 从XHR请求获取BLOB数据 Internet Explorer and Firefox do not support the WebP image fo

...

只需将base64字符串转换为位图,而不是使用下面的代码将该位图加载到imageview中 byte[] decodedString = Base64.decode(encodedImage, Base64.DEFAULT);

Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);

image.setImageBitmap(decodedByte);

Just con

...

您将base64图像字符串转换为byte [],如下所示: byte[] decodedByte = Base64.decode(yourBase64String, 0);

之后,你也可以将其转换为位图: Bitmap bitmap = BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length);

You convert a base64 image string to byte[] like : byte[] deco

...

使用关键字_binary为SQL添加前缀“ $query = "INSERT INTO `complaints`

(`myImage`,...)

VALUES (_binary'".addcslashes($blobImage, "\x00\'\"\r\n")."',...)"

此外,使用CURL设置测试环境,以便您可以重复抛出base64编码的图像。 这将是您需要大量调试的情况。 <?php

$f = fopen('sample.jpg.base64.txt', 'w');

$i = fope

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值