0

kristen_stewart.jpg dimensions: 400 x 270

<html>
    <head>
        <title>image</title>
    </head>
    <body>
        
        <p> 
            <img src="pics/kristen_stewart.jpg" width="200"  height="200"  alt="Kristen stewart" title="Kristen stewart" />
            
        </p>

    </body>
</html>

So when I am uploading it I alters the dimensions to 200 x 200 but when I download it from webpage it still containing dimensions 400 x 270. So why is this happening ?

Abhishek Mane
  • 619
  • 7
  • 20
  • 2
    The attributes `width=""` and `height=""` do not edit the loaded image in any way, it just change how big the image will be displayed (and automatically scaled up/down by the browser). What exactly is the problem you have and what are you trying to do? – Progman Jul 22 '21 at 14:02
  • 1
    _"So why is this happening ?"_ Why *wouldn't* it happen? – j08691 Jul 22 '21 at 14:04
  • @Progman I just download the image which I put on web by changing dimension then I see it's dimensions are original one not which on web-browser so I feel that strange . so I asked it. By the way I got it. Thanks – Abhishek Mane Jul 22 '21 at 17:14
  • @j08691 I got it via comment of `program`. Thanks – Abhishek Mane Jul 22 '21 at 17:16
  • @Progman https://stackoverflow.com/q/68479584/11862989 can you answer this Question please. – Abhishek Mane Jul 22 '21 at 17:17
  • @j08691 https://stackoverflow.com/q/68479584/11862989 can you answer this Question please. – Abhishek Mane Jul 22 '21 at 17:17

1 Answers1

0

The CSS in the img tag displays the image in the dimensions 200 x 200, it doesn't affect the dimensions of image file in any way

If you want to allow the user to crop the image file before uploading, you would've to use some JavaScript library like Cropper

Shardul Birje
  • 341
  • 5
  • 14