Last active
August 31, 2018 11:06
-
-
Save 1c7/4ab1422d57dcb752917d6be1563fbc36 to your computer and use it in GitHub Desktop.
Fix accidentally store base64 img into database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://1c7.me/2018-8-31-fix-base64-img-in-database-to-url/ |
Author
Author
Ruby
insert into db
def inser_into_db
id = '434'
content = '[内容填这里]'
t = Topic.find(id)
t.content_html = content
t.save
render json: "成功更新文章id #{id} 内容"
return
end
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python3 (The key part, Extract base64 into image file)
filename:
decode_base64_to_image.pyyou should modify following code to fit your need