Since I didnt get any response, I thought of playing around with some PHP code myself. ( I am using WP 2.1 )
To some extent I managed to satisfy myself by making “Send to editor” button automatically add class=”imgleft” to the img tag it inserts in the post.
To do this, I opened the upload-js.php file ( its in wp-admin folder ) and inserted class=’imgleft’ ( note single quotes ) in the 3 <img tags just before they close i.e />
Here is how they looked after modifications.
h += “<img src='” + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + “‘ alt='” + this.currentImage.title + “‘ width='” + this.currentImage.width + “‘ height='” + this.currentImage.height + “‘ class=’imgleft’ />”;
h += “<img src='” + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + “‘ alt='” + this.currentImage.title + “‘ width='” + this.currentImage.width + “‘ height='” + this.currentImage.height + “‘ class=’imgleft’ />”;
h += “<img src='” + ( ‘thumb’ == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + “‘ alt='” + this.currentImage.title + “‘ class=’imgleft’ />”;
Now add class imgleft in the style.css file ( or whatever css file u r using )
Upload it to the proper folders and thats it. Do make backup of these files before making any changes.
Now when you insert an image by clicking “Send to Editor” button you will see class=”imgleft” attribute already added.
Now if someone can help me in adding an option (radio buttons ) to select the class I want to add in this tag