A useful library for adding image upload fields to your plugin or admin page.
This is a library. It doesn't actually do anything by itself. To use it in a plugin:
require_once( 'image-upload-helper/image-upload-helper.php' );
image_upload_helper()wherever you want an upload dialog available.
image_upload_helper() function takes an array of arguments to control exactly what the form
field_name- Required. The name of the form field that will be submitted. Defaults to "image-upload-helper". Use this to customize the field to fit in with your form. By changing the
field_namevalue, you can call
image_upload_helper()as often as you like on each page.
thumbnail_id- The attachment ID of the current value of the field.
label- The label to use for the field. Defaults to "thumbnail image". This will display as "Set thumbnail image" or "Remove thumbnail image" in the form, or "Use as thumbnail image" in the iframe dialog
size- The size of the image you want displayed in the form. Defaults to "post-thumbnail". If you want to display a custom size, make sure you register it.
When a form is submitted with an Image Upload Helper field, the field specified by the
will contain the attachment ID of the selected image.