Aligning Images In RSS Feeds
When inserting an image into a post, WordPress lets you choose an alignment (left/right/center/none) and even add a caption. This usually works well when viewing the post on the blog itself, but will often look messed-up in the RSS feed. Basically, the image becomes unaligned and breaks the intended post layout. I’ve found an easy way to fix it.
As it turns out, the problem appeared when WP developers chose to remove the deprecated “align” attribute from the WordPress-generated <img> tags. Now, following web standards is all well and good, but what if you still want to align an image in a way that works in the feed, too? The typical answer is to add a style="float:left;" (or “float:right;”) attribute to each aligned image. However, that would become very bothersome if you had to manually edit the HTML code every time.
So I created a plugin that will do it automatically.
Plugin Description
“Align RSS Images” is a simple plugin that scans your RSS feed and ensures that every image has the correct alignment and margin settings. Technically speaking, it finds HTML elements styled with any of the WordPress-generated classes and appends an appropriate style attribute to each element. This is done dynamically when the feed is generated, so your actual posts won’t be modified.
Sidenote : Yes, I know that using styles in a RSS feed isn’t exactly standards-compliant either. Nevertheless, it works fine with Google Reader and the W3C Feed Validator says the feed is OK. So most likely the sky won’t fall on your head if you use this plugin
Download
align-rss-images.zip (2 KB)
Requirements : WordPress 2.6 or later
Installation : Just upload and activate. The plugin is completely automated, but due to caching you may need to wait a few hours for the changes to appear in your RSS reader.

Still not working… WP 2.8.6, Gabfire WPNewspaper Theme, http://www.cronicamarinaalta.com, installed the plugin but images on RSS are not aligned, what should i try?
Nice plugin, good work!
[...] więc aby dobrze wyświetlać obrazki w RSS możesz śmiało pobrać wtyczkę ze strony autora. Podziel się z [...]
Great! I’ve been looking for something like this to fix the images in my RSS feed. Thanks for the plugin!
[...] Align Images in RSS Feeds – does what it says on the box. WordPress uses styles to align images, but those styles don’t work in RSS feeds. All images end up as non-aligned in the feed. Eric Gray of VCritical (Blog – Twitter) turned me on to this simple plugin that fixes ‘em. [...]
[...] ۱-Align Rss Image: خیلی افزونهی کاربدیای است، باعث میشود که چپچین و یا زاست چین بودن مطالبتان در در فیدخوانها حفظ شود. خیلی هم کم حجم است! [...]
[...] There is a workaround for this problem. It’s not exactly a kosher fix, but it does resolve the problem for most feeds. A WordPress plugin has been designed by Janis Elsts called Align RSS Images. [...]
[...] ۱-Align Rss Image: خیلی افزونهی کاربردیای است، باعث میشود که چپچین و یا راست چین بودن مطالبتان در در فیدخوانها حفظ شود. خیلی هم کم حجم است! [...]
[...] Aligning Images In RSS Feeds | W-Shadow.com Plugin de WordPress para darle alineamiento a las imágenes en los feeds (tags: images plugin wordpress align feed) [...]
[...] 2. Align RSS Images [...]
[...] correctly listing in the left or right aligned location. Here is a excellent wordpress plugin by w-shadow.com which would allow you in fixing this problem [...]
[...] Align RSS Images is one of many plugins offering this functionality and probably the easiest to use: upload/install the plugin, activate it and enjoy looking at your own entries with properly aligned images in your feed from now on. [...]
Great plugin – exactly what i needed to fix the images in my RSS feed.
Thanks!
[...] you subscribe to a blog by RSS feed, you’ll know that images can appear all over the place. Align RSS Images makes sure that the images in a feed are in the same place as they are on the actual [...]
[...] la que j’ai découvert le plugin « Aligning images in RSS feeds » qui permet de faire ce traitement sur le contenu pour ajouter des balises style avec [...]
I don’t think this works in Google Reader
Just checked Google Reader. The image alignment looks to be working on this end. Perhaps you’re using custom image CSS that’s not recognized by the plugin?
[...] – Align Rss Image : خیلی افزونه*ی کاربردی*ای است، باعث می*شود که چپ*چین و [...]
[...] automatisierte Lösung, die Bilder im Feed so wie im Blog zu positionieren bietet ein kleines Plugin namens Align-RSS-Images, das den Feed jeweils mit der richtigen Positionierung der Elemente versieht. Das [...]
[...] correctly listing in the left or right aligned location. Here is a excellent wordpress plugin by w-shadow.com which would allow you in fixing this problem [...]
I usually insert images with captions, that is inside a div. Now the div is aligned, not the image. Can your plugin be extended to handle divs also?
Yes. You need to add the appropriate class-name and style rules to the $explicit_alignment_styles array in rss-image-align.php.
For example, lets say your HTML structure looks like this :
…and your CSS looks like this :
In this case, you would need to add a line like this to the .php file :
[...] post and they align nicely, things won’t look as pretty when you get the post in a feed reader. This plugin aligns images in your RSS feed so they are exactly where they would be on your [...]
I love this plugin, but it broke in WP 3.01. I’ve been up two nights scrounging img alignment tweaks but no luck.
It seems to be working fine on my test site(s). Are you sure it’s the 3.0.1 update that caused it to break, not a conflict with another plugin or something?
Only other formatting plugins are WP-Columns and TinyMCE Adv. I gotta *confess to monkeying around* with 3.0′s hot new editor-styles. Now the .alignment conflicts drive me nuts because I’m too much of a noob. I don’t know the css hierarchy order or which files are read first, so I got stuck in a mess. My site is OK. The WYSIWYG editor is repaired mostly OK. I’m ready for a clean install to take another crack at it. Thanks for your reply Shadow.
Well, the plugin expects alignment to be specified via certain CSS classes – “alignleft”, “aligncenter”, “alignright” and so on. Normally the post editor will automatically furnish each image with the right classname. But if you start using a different method to align your images the plugin will no longer be able to tell how they’re supposed to be aligned.
In that case, you should add your custom CSS classes – if that’s what you use – to the $explicit_alignment_styles array in rss-image-align.php.
I looked into your elegant code. I was importing theme styles into TinyMCE Advanced plus fiddling with 3.0′s new editor-style.css. I’m betting both were importing. When WordPress loaded a test post into its editor, alignment was perfect at first, then slightly paused, then in a quick flash jiggered the alignment incorrectly. Although I copy/pasted identical lines, it seems reading one file and over-riding the other broke the alignment. Using *only* styles.css, my problems went away and your excellent Align RSS tool is working perfectly as always. Sorry to fill your comment thread with noob.
I just switched my feed to ATOM as default, could your plugin work with that feed too? I am using this plugin to do that: http://wordpress.org/extend/plugins/atom-default-feed/
It already should. I just tried the “Atom Default Feed” plugin on another site of mine and the images in the feed were aligned.
great. I have no deeper knowledge about the itnernal workings of RSS versus ATOM so I thought it would be easier to jsut ask instead of hunting for that bit of information.
thanks