Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture canvas as image & upload to 000000book #3

Open
jamiew opened this issue Jun 3, 2010 · 6 comments
Open

Capture canvas as image & upload to 000000book #3

jamiew opened this issue Jun 3, 2010 · 6 comments

Comments

@jamiew
Copy link
Collaborator

jamiew commented Jun 3, 2010

Thought I had some code started for this. Will look around. 000book cannot currently generate thumbnails for uploaded tags (and having the page elements w/ the graffiti is crucial!)

@tbx
Copy link
Owner

tbx commented Jun 3, 2010

oh this'll be sick! ALSO I'll look around for "capture webpage" code, so we can upload the entire screenshot including the drawing. Found an old one for FF, but looks obsolete. Chrome has a completly different solution.

@jamiew
Copy link
Collaborator Author

jamiew commented Jun 3, 2010

is chrome support on the horizon?!

@tbx
Copy link
Owner

tbx commented Jun 3, 2010

at the moment the code isn't (as far as I think) using any FF specific stuff. So in theory, it will be possible to support it. I would like to have it for chrome at some point. Also look at Issue 1 for this.

@tbx
Copy link
Owner

tbx commented Jun 3, 2010

Now it's getting FF specific though:
*Render page content into a canvas: ctx.drawWindow(window, 0, 0, 100, 200, "rgb(255,255,255)"); from: https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas
*Store canvas into a file demo: http://mdn.beonex.com/en/Code_snippets/Canvas AND http://stackoverflow.com/questions/934012/get-image-data-in-javascript

@tbx
Copy link
Owner

tbx commented Jun 25, 2010

A little library for Canvas to IMG file -> http://www.nihilogic.dk/labs/canvas2image/
ALSO: (via stackoverflow):
Firefox and Opera have a toDataURL() method that returns a data-URL formatted PNG. You can assign the result to a form field to submit it to the server.

The data URL is base-64 encoded, so you will have to decode it on the server side. You would also need to strip off the "data:image/png;" part of course.

@jamiew
Copy link
Collaborator Author

jamiew commented Jun 25, 2010

Yo I almost forgot that I got this working in canvasplayer a while back. Works great, just need to add upload support on the 000book side
http://github.com/jamiew/canvasplayer/tree/savethumbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants