How to display images properly on Feed Readers

Feed Readers suck only your content, all the style elements always stay on your blog. The result? Your post looks so cool online, but when it hits the RSS readers (as seen by the people who actually read your blog), the images are broken.

Figure 1 - Properly Formatted Image

Figure 1 - Properly Formatted Image

Figure 2 - Image Broken in RSS FEED

Figure 2 - Image Broken in RSS FEED

If your images looks like figure 1 online and like figure 2 in your RSS reader or inbox, then follow some simple steps to make them look good.

Formatting Images in the RSS Readers

There are two was to do this:

Using an inline style element with every image (Not Recommended):

WordPress uses classes to define the style of images. Right aligned images are included in a class allignright and it’s defined in your style sheet, style.css.

Unfortunately, RSS readers cannot read your style sheets, so the styling of the images is lost.

To counter this we can include an explicit style=”float:right;” inline with the image. See the code below:

[sourcecode language='css']
WordPress Blue Links
[/sourcecode]

But using inline style is a bad practice, but if the next one doesn’t work for you, add the style inline.

Using the Align attribute:

Add align=”right” (replace right with left, or center if you want your image to be in those areas)

See the example below:

[sourcecode language='css']
Wordpress Logo
[/sourcecode]

How to Add the Attributes

- Switch to the code editor – HTML View:

Switch to Code Editor - HTML View

Switch to HTML View

- Find the code for the image and copy-paste the align attribute (align=”right”) to the end of the code. That’s it.

Insert Align Attribute Manually

Insert Align Attribute Manually

Create a Custom Quicktag for the Align attribute

Either you can save the attributes in a text file and copy paste them every time or you may create a custom Quicktag.

Custom Quicktag for Align Attribute

Custom Quicktag for Align Attribute

Quicktags are defined in quicktags.js in the wp-includes\js folder. In WordPress 2.8 this file is compressed and editing is not easily possible. There is another file quicktags.dev.js which is the expanded version.

- Backup both files and delete quicktags.js. Rename quicktags.dev.js to quicktags.js.

- Insert the following function to the list of other similar functions defined in quicktags.js (the renamed version of quicktags.dev.js):

[sourcecode language='php']
edButtons[edButtons.length] =
new edButton(‘ed_imgar’
,’IMG Allign’
,’align=”right”‘
,”
,’t’
,-1
);
[/sourcecode]

Now you will see a new button in the HTML view as show in the image above. Move the cursor to the code of the image and press the button and the code will be inserted.

The code above will insert align=”right”, if you want left of center, create similar buttons. For every button the function name has to be different. ed_imgar is the function name of the above button.

Broken images are history!

KishPress : Professional WordPress Tools

You May Also Like To Read:

  1. Add the Fast Forward Button Right from the Post Editor
  2. Optimizing Images For the Web
  3. Why You Ought To Use the Read More Tag In WordPress and How To Configure It Properly
  4. Display Tweets in Your Posts with Tweet Freezer
  5. Add Custom Status or Notes to a Post without a Plugin

This entry was posted in WordPress Optimization and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

For More Like, "How to display images properly on Feed Readers"
Grab the Feed or,

20 Comments

  1. Posted July 11, 2009 at 16:57 | Permalink

    This is interesting, you have put in a lot of work here. Currently I use a plugin called ‘Align RSS Images’ to do this job for me. I will try this, maybe I can reduce the number of plugins I use. Thanks.

    • Posted July 11, 2009 at 20:34 | Permalink

      Welcome to the league. I knew there were plugins, am a plugin minimalist, so code is my choice.
      Thanks for the words :)

  2. Posted July 11, 2009 at 23:33 | Permalink

    yah Arun, i am always facing this alignment problem with images and videos too.
    So, i am thinking, you have solved my some problems. :)
    Thanks for sharing with us.

  3. Posted July 12, 2009 at 06:00 | Permalink

    Nice post buddy. Many of them could now get the alignment problem solved easily. Good Luck :) .

  4. Posted July 12, 2009 at 07:58 | Permalink

    Thanks buddy, nice tips, will follow these :)

  5. Posted July 13, 2009 at 16:26 | Permalink

    Nice and simple trick :)

  6. Posted July 17, 2009 at 01:33 | Permalink

    I think the latest release of wordpress has the align image function built-in. Or are you suggesting that we do not use the builtin image align function.

    While I have used the function to align my images with text of the post, I am not sure if it came out all right on the feed reader or not. Please let us know.

    • Posted July 17, 2009 at 01:44 | Permalink

      I am not suggesting not to use use the inbuilt align. The image uploader adds a class attribute to the image, and the class is defined in your css. It does not actually insert the align attribute.

      Check your post with a right aligned image in a feed reader. If its looking good, you don’t have to do anything. Else use this tweak :)

  7. Posted August 3, 2009 at 14:28 | Permalink

    very good tips, thanks a lot for your effort!

  8. Posted August 18, 2009 at 18:21 | Permalink

    Nice piece of info..I will try following it..

  9. Posted September 4, 2009 at 16:45 | Permalink

    i usually didn’t bother about RSS
    but hey, great tips !!

    • Posted September 4, 2009 at 19:10 | Permalink

      When it comes to RSS, Content is the real and only king! Thanks for the compliment. Glad you liked.

2 Trackbacks

  1. By Twitted by inaghita on July 14, 2009 at 19:51

    [...] This post was Twitted by inaghita [...]

  2. [...] How to display images properly of Feed Readers [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting

  • Get Free Updates

Home · Archives · About · Contact · Advertise · Hire Me · RSS
© 2006 – the end of time, Arun Basil Lal. Powered by WordPress, H2O and an Awesome Bunch of Friends.