base64

Base64-encoding a Videofile in js

Deadly 提交于 2021-02-08 06:47:11
问题 So i've got a video file and the path to it (e.g. /outerfolder/innerfolder/video.mp4 ). I now want to encode this video with Base64 in JS so that I am able to store it in a database. If you could help me with the encoding of the video file, I would be very thankful. Thanks in advance. 回答1: You could encode the file with the following function to convert your file to an ArrayBuffer: [update] //<input type=file id="encondeMP4"> var encodeMP4 = document.getElementById('encondeMP4'); You now add

Android Base64 Audio File Encode / Decode

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 04:29:09
问题 Doing: I am currently recording voice and saving it as a file in sdCard which is running playing fine in MediaPlayer. What i want: When i encode this file intoBase64 and send to server, everything goes fine. But When i decode the Base64 String into audio.m4a file, it is not running in MediaPlayer. I had tried .m4a , .wav but all in vain. The problem is in encoding. Because when i decode a file sent from the same iOS app, it runs fine in MediaPlayer. I know its very basic and alot of help is

In react native, how to convert a base64 image to jpg then save to temp path?

大憨熊 提交于 2021-02-07 14:23:11
问题 In react-native , converting an image to BASE64 format is easy, with a little help of react-native-fetch-blob , I simply do: RNFetchBlob.fs.readFile(filePath, 'base64') .then((data) => console.log(data)); But, what about the other way around? I know there are some packages out there that does it, but I wonder if it's possible to do it with only react-native-fetch-blob or react-native-fs ? What I want is that after converting and saving the BASE64 image to a file, I am able to display it like

In react native, how to convert a base64 image to jpg then save to temp path?

一笑奈何 提交于 2021-02-07 14:20:43
问题 In react-native , converting an image to BASE64 format is easy, with a little help of react-native-fetch-blob , I simply do: RNFetchBlob.fs.readFile(filePath, 'base64') .then((data) => console.log(data)); But, what about the other way around? I know there are some packages out there that does it, but I wonder if it's possible to do it with only react-native-fetch-blob or react-native-fs ? What I want is that after converting and saving the BASE64 image to a file, I am able to display it like

Save Base64 String into Django ImageField

ⅰ亾dé卋堺 提交于 2021-02-07 12:19:02
问题 Im doing an application that uses Django in server-side. Im trying to do that: import uuid from base64 import b64decode from django.core.files.base import ContentFile @staticmethod def add_photo(user, person, image_base64): photo = DatabasePersonPhoto() photo.user = user photo.person = person image_data = b64decode(image_base64) image_name = str(uuid.uuid4())+".jpg" photo.image = ContentFile(image_data, image_name) photo.save() return photo This is my Base64 String: data:image/jpeg;base64,/9j

Save Base64 String into Django ImageField

空扰寡人 提交于 2021-02-07 12:15:32
问题 Im doing an application that uses Django in server-side. Im trying to do that: import uuid from base64 import b64decode from django.core.files.base import ContentFile @staticmethod def add_photo(user, person, image_base64): photo = DatabasePersonPhoto() photo.user = user photo.person = person image_data = b64decode(image_base64) image_name = str(uuid.uuid4())+".jpg" photo.image = ContentFile(image_data, image_name) photo.save() return photo This is my Base64 String: data:image/jpeg;base64,/9j

Save Base64 String into Django ImageField

巧了我就是萌 提交于 2021-02-07 12:15:30
问题 Im doing an application that uses Django in server-side. Im trying to do that: import uuid from base64 import b64decode from django.core.files.base import ContentFile @staticmethod def add_photo(user, person, image_base64): photo = DatabasePersonPhoto() photo.user = user photo.person = person image_data = b64decode(image_base64) image_name = str(uuid.uuid4())+".jpg" photo.image = ContentFile(image_data, image_name) photo.save() return photo This is my Base64 String: data:image/jpeg;base64,/9j

java - decrypt a file with base64

你。 提交于 2021-02-07 11:10:26
问题 In my project a textfile is chosen and become encrypted. The encrypted text is saved seperatly as well as the key. Now I try to create a program which is decrypting the file when the right keyfile is available. I think the decrypting program needs to look pretty like the encrypting program just in DECRYPT_MODE . When I read in the key I don't know how to do the next step at it to decrypt the textfile. Maybe anyone can help me how I use the key from .txt file and use it to decrypt the encoded

binascii.Error: Incorrect padding, even when string length is multiple of 4

别等时光非礼了梦想. 提交于 2021-02-07 06:34:39
问题 I am trying to convert base64 string to image by python code, but I am getting binascii.Error: Incorrect padding I have gone through with my solution but they only suggest check string length is divisible 4, if not make it divisible by 4 by adding '=' characters at the end of base64 encoded sting. Please help in this. PYTHON CODE: (please check code from drive for more visibility) import base64 strOne= 'data:image/png;base64,iVBORw0KGgoAAAANSU...string has 200000 character thats why I couldn

binascii.Error: Incorrect padding, even when string length is multiple of 4

孤街醉人 提交于 2021-02-07 06:32:13
问题 I am trying to convert base64 string to image by python code, but I am getting binascii.Error: Incorrect padding I have gone through with my solution but they only suggest check string length is divisible 4, if not make it divisible by 4 by adding '=' characters at the end of base64 encoded sting. Please help in this. PYTHON CODE: (please check code from drive for more visibility) import base64 strOne= 'data:image/png;base64,iVBORw0KGgoAAAANSU...string has 200000 character thats why I couldn