Not really LaTeX related, but... How can I modify image size in canvas? @rational
For example if I want to put this (attachment) into canvas;
|dw:1432454414010:dw|
|dw:1432454439414:dw|
Yeah/ how did you do that?
earlier script is automatically resizing the image to 500x300 creating that blur
one sec il put the updated script
try this $.getScript(' http://assets.openstudy.com/updates/attachments/556184f6e4b0e23384b8d22f-rational-1432454693607-draw.js')
you may have to refresh the page before getting that script in console
It works, thanks! |dw:1432454806261:dw|
it is very easy to play wid canvas i can show u if u know a bit of javascript
I do know a bit of javascript, but this doesn't look short and nice haha. http://assets.openstudy.com/updates/attachments/556184f6e4b0e23384b8d22f-rational-1432454693607-draw.js then again I am not familiar using javascript on canvas.
Ahh thats because i have minified it so that it loads faster
try this in console: ``` var canvas = $('#drawing-dialog .canvas').data()["whiteboard"].canvas; ```
open drawing board before typing that
that gives you the canvas object now we can draw anything we want using that object
for example, to draw a circle, we do : ``` canvas.circle(100, 100, 50); ```
woah
is it working
yeah it does
pretty easy
to insert an image try this : ``` canvas.image(url, x, y, width, height); ```
What do you enclose URL with? quote, right? because it doesn't work?
yes double quotes, example canvas.image(" http://assets.openstudy.com/updates/attachments/556184f6e4b0e23384b8d22f-geerky42-1432454398350-123-thumbnail.png ", 0, 0, 500, 500);
Still doesn't work. Error is "Cannot read property 'image' of null"
after opening drawing board, did u assign "canvas" variable again ?
type below two commands after opening drawing board : ``` var canvas = $('#drawing-dialog .canvas').data()["whiteboard"].canvas canvas.image(" http://assets.openstudy.com/updates/attachments/556184f6e4b0e23384b8d22f-geerky42-1432454398350-123-thumbnail.png ", 0, 0, 500, 500); ```
ahh I see. now it works.
it creates a fresh canvas everytime u click draw so canvas variable needs to be updated
oh I see. I need to go now... Thanks for all helps!|dw:1432455932330:dw|
np for more info look at raphaeljs documentation http://raphaeljs.com/reference.html#Paper.image
Ahhh, thanks again @rational for the amazing work :D
DEAN!!!!
Join our real-time social learning platform and learn together with your friends!