+ 25

How to get an image and control it's size using JavaScript? [SOLVED]

I'm making a code where I need to get an image drawn only once. I've got the url, but none of the suggestions in the StackOverflow about how to get it is working in the Sololearn console. It'll be very cool if someone helped🙂 //Please inform me if further details is required

20th Aug 2019, 3:22 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
16 Antworten
+ 14
Cbr✔[ Most active ], can you please tell me more about this library? And if I can't work it out in Sl, is there any other alternative to get an image in the output? Like web perhaps? If yes, how?
20th Aug 2019, 3:42 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
+ 12
Airree how to get one in canvas?
20th Aug 2019, 3:40 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
20th Aug 2019, 5:43 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
+ 8
The exemple <html> <head> <script type="text/javascript"> function aumentaImagem(nome){ nome.width = nome.width+50; nome.height = nome.height+50; } function tamanhoNormal(nome){ nome.width = 150; nome.height = 30; } </script> </head> <body> <img src="http://www.linhadecomando.com/logo-linhadecomando.png" name="logo" width="150" height="30" onclick="aumentaImagem(logo);" ondblclick="tamanhoNormal(logo);" style="cursor:pointer" /> </body> </html>
20th Aug 2019, 4:27 PM
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢 - avatar
21st Aug 2019, 3:15 AM
Aung Thiha
Aung Thiha - avatar
+ 5
If you want build an image, look at this example of a circle and a square drawn in JavaScript. One case without Javascript. After the header data, comments and the title "Normal HTML here." It starts with the <svg> tag, determines the circle properties with the <circle> whose attributes are cx (position on the evaluated axis), cy (position on the axis). ordinate), r (radius), and fill. For drawing the rectangle, the <rect> tag with its attributes, x (position in advertised), y (position in the ordinate axis), width (width), height (height), stroke (contour line) and fill ( fill). Then they wrap the <svg> tag and the html tags. Such <circle> and <rect> do not need to be enclosed with the same text. Just use />.
20th Aug 2019, 3:50 PM
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢 - avatar
+ 5
<! DOCTYPE html> <html>     <head>         <title> Theory - Drawings - http://brazilis.github.io </title>     </head>     <body>          <! - Examples of drawings in svg - http://braziljs.github.io/eloquente-javascript/chapters/design-com-canvas/--> <p> Normal HTML here. </p> <svg xmlns = "http://www.w3.org/2000/svg"> <circle r = "50" cx = "50" cy = "50" fill = "red" /> <rect x = "120" y = "5" width = "90" height = "90" stroke = "blue" fill = "none" /> </svg>          </body> </html>
20th Aug 2019, 3:58 PM
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢 - avatar
+ 5
Functions and Parameters In this other example (see https://www.line.com.com/javascript/javascript-changing-size-of-a-image), He throws the <script> tag between such <head> </head>, a function that enlarges the image (id name), concatenated name is width, = name, width +50 and the same for height; one for normal size (id name), concatenated name with width and assigns value, name with height and also assigns a value. In such a <body> he launches the image and the oneclick event (aumented size) with the image and id "logo" function. Then the ondblclick event with the normal size function. Then determine the cursor model.
20th Aug 2019, 4:25 PM
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢
Lυƈιҽɳҽ Bυʅԋõҽʂ Mαƚƚσʂ 🐢 - avatar
+ 5
[Tutorial] Upload content from your device to CodePlayground - The Dropbox way https://code.sololearn.com/WW6t4B73kJVz/?ref=app
21st Aug 2019, 12:21 AM
Gordon
Gordon - avatar
+ 4
Do you want to insert an image in the console?
20th Aug 2019, 3:30 PM
Airree
Airree - avatar
+ 4
Ehh... Console is only for TEXT you still have the entire document to display images
20th Aug 2019, 3:41 PM
Airree
Airree - avatar
+ 4
window.onload=()=>{ var img=new Image(); img.src="http://..."; img.width="120px"; img.height="120px"; document.body.appendChild(img); }
21st Aug 2019, 7:33 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 3
Do you want to insert an image
21st Aug 2019, 11:56 AM
Sri Ram
Sri Ram - avatar
+ 2
Pls can you tell me more about it
22nd Aug 2019, 12:31 PM
Benjamin Osei
0
Wow!!!.. So beautiful u 👉👤are.....
22nd Aug 2019, 6:56 PM
Ansh Gupta
Ansh Gupta - avatar
0
Are you talking about a new image or which already has?
31st Jan 2020, 5:19 AM
Chowdhury Tafsir Ahmed Siddiki
Chowdhury Tafsir Ahmed Siddiki - avatar