[wp-hackers] Plupload, WP 3.3 and client-side resizing
Braydon
ronin at braydon.com
Mon Jan 2 23:34:36 UTC 2012
Plupload has a resize parameter that can resize images on the
client-side, if possible. I haven't seen anything about it blocking images.
Here is the parameter from their docs (
http://www.plupload.com/documentation.php ):
var uploader = new plupload.Uploader({
(...)
resize : {width : 320, height : 240, quality : 90},
(...)
});
On the WordPress side, there is a filter "plupload_init" to modify default settings. On line 1331 of /wp-admin/includes/media.php resize isn't currently being used.
Adding this into functions.php should probably do the trick (untested):
add_filter( 'plupload_init', 'my_plupload_init', 0, 1 );
function my_plupload_init( $plupload_init ) {
$plupload_init['resize'] = array('width' => 1024, 'height' => 1024);
return $plupload_init;
}
On 01/02/2012 02:11 PM, Manuel Schmalstieg wrote:
> I am currently searching for documentation about the Plupload script
> that was integrated into the WP core with the 3.3 release.
>
> My needs are the following:
>
> - force a size limit of 1024px width / height for picture uploads.
> - if the picture is bigger, ask the browser for client-side downsizing.
> - if the browser can't do it, refuse the upload and provide a
> meaningful error message.
>
> I was wondering if WP 3.3 would provide a config panel for such
> settings, a bit like the (now obsoleted) WPlupload plugin did:
> http://wordpress.org/extend/plugins/wplupload/screenshots/
>
> Or can we define such things in functions.php ? Is there any
> "official" documentation about how Plupload works in WP? Any examples
> or "best practices"?
>
> Many questions. For some reason, Google didn't bring up any up-to-date
> information.
>
> Any advice would be much appreciated.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> !DSPAM:4f022ba7211011713282792!
>
More information about the wp-hackers
mailing list