file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

file

is there any way for whenever u select an image from your filed change the height and width? i tried my attempt here but it is giving me an error. https://code.sololearn.com/W0P3pqK8RU5r/?ref=app

6th Sep 2022, 10:27 PM
Junior
Junior - avatar
1 Answer
+ 1
pic.value.style.height = "300px" work for img HTML tag, not input file. To change image file before send form to back-end need external JS lib (or maybe process it in back-end server is a better way) : https://stackoverflow.com/questions/2434458/image-resizing-client-side-with-javascript-before-upload-to-the-server
7th Sep 2022, 6:11 AM
Roland
Roland - avatar