GithubHelp home page GithubHelp logo

Comments (2)

ivictbor avatar ivictbor commented on August 26, 2024 1

Hi @Rajan4436 ,
sorry for long response, I had no access to my PC so was not able to respond.
If I understand your task correctly you need to persist image between page loadings.

  • You can get image as dataurl by calling painterroInstance.imageSaver.asDataURL().
  • You can save it to localStorage, or to your backend, or using filesystem API, etc. (localStorage have some quota https://arty.name/localstorage.html, so it will not work for large images)
  • then just pass dataurl to show method (show method accepts all types of URLs: plain like http://something/file.jpg or data data:...)
  • I also added changeHandler param so you can define handler which will be fired after each change on canvas
    So it can look like this:
Painterro({
    changeHandler: function (state) {
      localStorage.setItem('painterroImage', this.imageSaver.asDataURL())
    }
  }).show(localStorage.getItem('painterroImage'));

Fiddle: https://jsfiddle.net/vanbrosh/zL4ay02c/1/
I think passing state as URL params does not sound like a good idea because state takes too much data to fit in URL. Painterro creates canvas snapshot for each change (common approach for raster editors) because it may have raster data parts (loaded, pasted from clipboard, etc). So as I mentioned before you can persist image to some storage. If you need you can associate some id with stored image and pass this id as route param.

from painterro.

rajanverma-me avatar rajanverma-me commented on August 26, 2024

Awesome

from painterro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.