The best thing I liked about the new v3.5 media manager was being able to insert images to a post hosted by an external site like photobucket using "Insert from URL". I normally format my image inserts manually and was hoping "Insert from URL" would reduce some of my work.
Unfortunately I can't add anything to the img src tag that is generated. Specifically I use the alignright class alot but this is ignored in the RSS feed so if I republish my blog post on a non-wordpress powered site the images aren't floated. I want to add an extra style="float:XXX" to the code that is sent to the editor to cover that issue.
If $align is 'right' then it outputs float:right and so on.
I am doing this as a personal plugin and I got it activated but it doesn't output anything when I use "Insert from URL"
I've searched all these help sites and really haven't found anything exactly as I need and my experience level with PHP and wordpress is kind of low (I understand the concepts but have trouble with the syntax)
The closest I got was this previous question: Need help building a filter to edit the output of “image_send_to_editor”
Here is the function I have so far and any hints or tips on what I am doing wrong will help me.
add_filter('image_send_to_editor', 'dlb_filter_fl',10,8);
function dlb_filter_fl ($html, $id, $caption, $title, $align, $url, $size, $alt) {
if ($align == 'right');
$html = '<img src="' . $url . '" class="' . $align . '" style="float:right" />';
return $html;
}
I could be using the wrong filter. I'm not sure. Right now the code is active and get no fatal errors but it doesn't add anything to my img scr tag.