You know I have been intending to release this for literally six months now. I originally wrote it for a client as a way to get company logos to appear inside WordPress posts… easy you say huh? What about if we were dealing with people who had no idea what to do when looking at the standard wordpress ‘Add Media’ or ‘Add Image’ page. It all seemed a bit too complicated for the average person so SB Uploader was born.
The idea of the plugin is that it means the act of uploading an image can be done on the same page as the Post/Page editor and there is no separate upload button, just the Save/Publish Post/Page button as normal. This ensures that as part of their blog post or copywriting process an image could be chosen before publishing.
How does it work?
Well the plugin uses JQuery to add the ‘enctype’ argument to the form on the editor page meaning no code WordPress code manipulation is necessary. A box is added to the top right hand corner of the edit page interface with a simple file selector with browse button. When the user hits Publish/Save the file is uploaded and the URL put into a post/page custom field called company_logo. This can then be used by your theme using the following code:
if ($image = get_post_meta(get_the_ID(), 'post_image', true)) {
$image = '<img src="' . $image . '" alt="Image" />';
}
echo $image;
I would normally wrap the image variable in a div tag with a class or give the image itself a class so that I can restrict the size or float the image (or both?) using the stylesheet. It simply means that you can include that image inside a template if it exists.
So far I have used it on several sites and not one person had managed to break it or struggled using it. That isn’t a challenge though!
As a little bonus for those that know what they are doing I have written a very basic file explorer to allow you to look around the file system of the site in question and upload/download files as appropriate. This isn’t included on the Post/Page Interface but is included as a plugin menu so it can easily be turned off or separated using something like the Adminize plugin (which I really do love!).
Screenshots
- Upload box with no existing file
- Upload box with existing file
- Basic File Manager
Download: SB Uploader (12.51 kB)
Enjoy! Feedback always welcome…




