Plugin Directory

SB Uploader

An easy, customer/user friendly way to upload images and attach them to your content. Optionally sets the featured image. Sometimes you just want to u

I originally wrote this 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.

I have added the ability to also upload images to a category/tag/taxonomy so you can have images showing related to a particular taxonomy. The plugin now allows you to have multiple instances of an uploader meaning that each page can have as many images attached as you like. It also creates shortcodes for each image and allows access via custom widgets as well. I'm pretty sure that's all bases covered for now.. Do let me know if you want to see this plugin extended in ANY way.

How does it work (Posts/Pages)?

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 in your posts and pages using the shortcodes which are made available by the plugin.

Alternatively if you wish to use them more fully within your theme you can use one of the following pieces of code. Note that these are the function declarations themselves. The usage instructions are below them:

function sbu_get_the_image($custom_field, $post_id=false, $url_only=false, $width=false, $height=false, $quality=100) { global $sbu;

return $sbu->get_the_post_image($custom_field, $post_id, $url_only, $width, $height, $quality);

}

function sbu_the_image($custom_field, $post_id=false, $url_only=false, $width=false, $height=false, $quality=100) { echo sbu_the_image($custom_field, $post_id, $url_only, $width, $height, $quality); }

function sbu_get_the_image_resized($custom_field, $width=false, $height=false, $quality=100, $post_id=false) { return sbu_get_the_image($custom_field, $post_id, false, $width, $height, $quality); }

function sbu_the_image_resized($custom_field, $width=false, $height=false, $quality=100, $post_id=false) { echo sbu_get_the_image_resized($custom_field, $width, $height, $quality, $post_id); }

function sbu_get_the_category_image($custom_field, $post_id=false) { global $sbu;

return $sbu->get_taxonomy_image($custom_field, $post_id);

}

UPDATED: added the following code to grab images from the core uploader. This method resizes and saves multiple versions within the system as you would expect from the normal WP uploader but with a simpler, more customer friendly, interface.

get_image($image_size_name, $post_id); } ?>

If the above doesn't make sense then, in basic terms, you just need to put something like this in your theme:

or if you wish to resize an image to fit a slot use this:

This would output the image as 700x200. Both parameters are optional so if you wanted a proportional resize based on 700 pixels in width then use this:

Or the old fashioned direct method of retrieving the image.

if ($image = get_post_meta(get_the_ID(), 'post_image', true)) { $image = ''; } echo $image;

How does it work (Tags/Categories/Taxonomies)?

As above with the jQuery but the file upload boxes are added to the taxonomy edit pages instead. Just click browse, choose an image and save the taxonomy/tag/category and you're done.

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. Of course you could use the resize function I have provided above to get that perfect sized image on your site.

I would like to add that there are NO adverts or links back to my site in this plugin. I personally hate it when, on adding a new plugin, dashboard widgets, donate buttons and backlinks appear. This plugin is clutter free and support is always available via my site and the WP forums. Have fun!

More info at http://www.sean-barton.co.uk/sb-uploader/

Requires: 3.0 or higher
Compatible up to: 3.3.2
Last Updated: 2012-5-9
Downloads: 3,553

Average Rating

5 stars
(5 ratings)

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1 100,1,1
100,1,1