pixel-paint | spirte art tool for making 32x32 sprites | Canvas library
kandi X-RAY | pixel-paint Summary
kandi X-RAY | pixel-paint Summary
Make intuitve pixel art in this simple drawing tool written in vanilla javascript :cake:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pixel-paint
pixel-paint Key Features
pixel-paint Examples and Code Snippets
Community Discussions
Trending Discussions on pixel-paint
QUESTION
Alright, so I've been trying to find out how to do this for awhile, but to no avail, so I thought I'd just ask here! I want to be able to upload whatever you draw on this canvas to Google Drive easily, with the click of a button, but every time I try to assign the data-src for the Google Drive API, I can't. I don't know how to incorporate the Javascript into the html. I have a save button that uses canvas.toDataUrl, but I also want a Google Drive save button that uses the toDataUrl as the src. My code is below. I did this all on repl.it, so you can also find my code on https://repl.it/@AnthonyRobinso2/Pixel-Paint
HTML:
...ANSWER
Answered 2019-Dec-18 at 08:50From the Save to Drive documentation on the data-src
attribute/parameter:
data-src
is a required parameter containing the URL of the file to be saved.
URLs can be absolute or relative.
The
data-src
URL can be served from the same domain, subdomain, and protocol as the domain where the button is hosted. You must use matching protocols between the page and the data source.Data URIs and
file://
URLs are not supported.Due to the browser's same origin policy, this URL must be served from the same domain as the page upon which it is placed, or be accessible using Cross Origin Research Sharing (CORS). If the button and resource are on different domains, refer to Handle buttons and resources on different domains.(#domain).
To serve the file when the same page is served by both http and https, specify the resource without a protocol such as
data-src="//example.com/files/file.pdf"
, which uses the appropriate protocol based on how the hosting page was accessed.
It is explicitly stated that Data URIs are not supported for this method.
As an alternative, I suggest you use the Drive API Files: Create
method. Upon clicking the "save" button, you can use the Canvas' toBlob() method to convert it into a image/png
blob (or if you prefer, you can specify another output mimetype for it such as image/jpeg
) and then make the Create
request. For that, I suggest you check out the following links as I believe they can be useful to you:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pixel-paint
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page