There are so many people out there trying to auto resize the post images of their wordpress blogs or just about any CMS software out there be it blogger, joomla, drupal or even a custom CMS. The thing is CSS is enough to do this and while so many people search and search for a plugin or script to do this, they still get frustrated because they either have all images resized or the script may not work for their theme or website.

Here we will show you how to auto resize post images in a wordpress, blogger, joomla, drupal blogs or just about any CMS software or website such that the image auto resize only when the image is greater than the width of the specified width of the post.

Here you go!

.postclass img {
max-width: 500px;
width: expression(this.width > 500 ? 500: true);
}

/* OR */

#postid img {
max-width: 500px;
width: expression(this.width > 500 ? 500: true);
}

.postclass is the name of the post class for your wordpress blog.
#postid is the name of the post id for your wordpress blog.
max-width will be the width of your post. So the 500 will be changed to the width of your post width
width: expression(this.width > 500 ? 500: true) is the fix for IE, Internet Explorer web browser. So the 500 will be changed to the width of your post width

If you have any questions or if this doesn’t work, please post a comment below.

Related Posts

No related posts found

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.