Postie (for WordPress) [can] rock multiple image styles
Forget some of those nice things I said about the iPhone WordPress App. Version 2.6.3 is still causing me headaches.
What I really wanted was the ability to quickly post photos front and center. The problem is that more often, I am writing blog posts and all I want is for the image to float on the right side of the text and let the reader see a larger version of the image when clicking on it. From something like Windows Live Writer, that would be easy to choose which style to use but from the iPhone that has been less than easy. Since most of my mobile blogging is thru the Postie plugin for WordPress, I figured there had to be a way to support different image styles.
I started by hacking the Postie code and soon decided that was unwise. Then I thought about the postie_post filter function. Eureka! (the realization not the TV show). So I set out to write a function that would post process after Postie had done its thing. Here is how it all folds together …
I set Postie to use customer markup (on the image tab) which generates both the markup for a medium sized image floating on the right as well as the large markup of the image centered in the post. I then wrap the entire customer template field with a HEAD and TAIL markers. Finally, I add a marker for the first style and another marker for the second. The filter code just keys off how long the post is to decide if it should use one style or there other. In truth, it should be smarter than that but I was lazy. I’ll fix it after the first time it does what I say, not what I want.
Here is what my template looks like …
<!--POSTIEIMG1-->
<div style="margin:2px 4px 2px 8px;float:right">
<a href="{IMAGE}" target="_blank" ><img src="{MEDIUM}" alt="{CAPTION}" title="{CAPTION}"/></a>
<div style="padding:.4em;text-align:center; font-style: italic">{CAPTION}</div></div>
<!--POSTIEIMG2-->
<center>
<div style="margin:2px 2px 2px 2px;">
<a href="{IMAGE}" target="_blank" ><img src="{LARGE}" alt="{CAPTION}" title="{CAPTION}"/></a>
<div style="padding:.4em;text-align:center; font-style: italic">{CAPTION}</div></div>
</center>
<!--POSTIEIMGTAIL-->
For the curious or bored, here is the plugin filter code !



