简体   繁体   English

如何从HTML输入字段旋转jpeg文件并将其另存为base64字符串

[英]How to rotate a jpeg file from HTML input field and save it as a base64 string

I am using angular and taking in a HTML image file and i need to rotate the image based on the EXIF data which i have access to. 我正在使用角度图像并接收一个HTML图像文件,我需要根据我可以访问的EXIF数据旋转图像。 I am currently just saving it as a base 64 string but i need to rotate it CLIENT SIDE. 我目前只是将其另存为基数为64的字符串,但是我需要旋转CLIENT SIDE。

These are the steps you should follow: 这些是您应该遵循的步骤:

  • first get the image from input 首先从输入获取图像
  • then write the image on Canvas 然后将图像写在画布上
  • rotate the canvas 旋转画布
  • export the image 导出图像

you can also see my working example of this here: rotate image 您还可以在这里看到我的工作示例: 旋转图像
do not forget to run this in a server(ex: serve module ) for canvas security concerns 出于画布安全性考虑,不要忘记在服务器(例如: serve模块 )中运行它


hope it help. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM