Yesterday, if you have noticed, my blog was down for few hours. This was because I had problems with my WordPress theme with sidebars getting messed up and found it hard to fix it up. I finally managed to debug this issue and found out it was all due to image over-sizing in my latest post. I googled a lot to find a fix for auto resizing images in wordpress, but most of them were either blog theme specific or were controlling the image size before image upload.
Then I found out a quick and easy way to rezise images with CSS by keeping your image’s aspect ratio. This is very quick you can use it in less than 5 minutes, lets proceed!
Lets say you want to show large images on your web page with maximum 200 pixels width, blog or forums just create the following css class into your styling css file:
height : auto;
height : 300px;
Second class will resize the images by keeping height as 300 pixels. You can use the following classes in <IMG> tags like:
<img src="http://mywebsite.com/myphoto.jpg" class="resize" alt="my photo">
The above solution is always better than putting width and height attributes into the <IMG> tag. Hope it works out for you too