Resizing & Optimizing Photos Uploaded by MediaPress
Since Our initial release of MediaPress Beta, We got a lot of questions on how to optimize images after upload and minimize the disk space. Today, I wanted to show you how easy it was to bridge MediaPress with other existing plugins for the task.
Two of the plugins that we were asked for compatibility with are:-
It is very easy to use these two or any other plugin with MediaPress.
Using MediaPress with Resize Image After Upload plugin:-
To enable support for Resize Image After Upload plugin, you can add this line to your bp-custom.php
1 2 3 4 5 6 7 8 9 10 11 | add_action( 'init', 'mpp_custom_bridge_resize_after_upload' ); function mpp_custom_bridge_resize_after_upload() { if( function_exists( 'jr_uploadresize_resize' ) ) add_action( 'mpp_handle_upload', 'jr_uploadresize_resize' ); //that's all, have fun } |
That's all. I have made sure that it does not cause a fatal error if the Resize Image after upload plugin is deactivated. Now, The Resize Image after upload plugin will resize/optimize any image uploaded with MediaPress after this change.
Using MediaPress With EWWW Image Optimizer Plugin:-
It seems that this plugin does not need any change but in case it is not working for MediaPress, You can put these two lines in your bp-custom.php
1 2 3 4 5 6 7 8 9 | //ask ewww optimizer to optimize MediaPress Images add_action( 'init', 'mpp_ewww_optimizer_bridge' ); function mpp_ewww_optimizer_bridge() { if( function_exists( 'ewww_image_optimizer_handle_upload' ) ) { add_action( 'mpp_handle_upload', 'ewww_image_optimizer_handle_upload' ); add_filter( 'mpp_generate_attachment_metadata', 'ewww_image_optimizer_resize_from_meta_data', 15, 2 ); } } |
More tips for MediaPress, coming soon 🙂 Looking forward to your comments and suggestions.