dry9192 2015-06-25 06:47
浏览 40

将批量图像存储在$ localStorage中 - Angular JS

I'm using $localStorage service to store data in browser's cache. Actually I'm building a web application ( in angularjs and PHP ) on which user can upload multiple images on canvas, manipulate with them. What I was doing, when user uploads image/s, I was uploading this image to server and when user removes, I am unlinking it from the server but this approach only increases my server space with MBs/GBs of garbage data.

I'm looking to change my approach. Can I upload bulk of images on localStorage and when user submits his/her campaign, only then all of the images will send to the server ? Is there any approach can I go with ?

  • 写回答

1条回答 默认 最新

  • douli1854 2015-06-25 06:52
    关注

    You can do it, and you can read about the sole technicalities of how to achieve that in the answer to this question: How to save an image to localStorage and display it on the next page? (basically it boils down to saving a Base64-encoded image as a string)

    Mind that most browsers can only store up to several MB of data (depending on each browser, e.g. 5 for Chrome) in localStorage, so you will be limited by that.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料