Organize uploaded media files

Thans but I’ve found the solution, what it need to do is to edit the site (Network -> Sites -> Edit -> Settings ) and change the following parameters: Uploads Use Yearmonth Folders 0 Upload Path wp-content/blogs.dir/1/uploads Fileupload Url http://www.mydomain.com/myblog/uploads

Multisite, upload images directly to Amazon S3

If you are running on a dedicated linux server and are comfortable with the command line, you could install s3fs. This is a program that allows you to actually mount your Amazon s3 Bucket as a directory on you server. In the standard multisite environment, media uploads for all sites but the main site are … Read more

There’s a way to scale media (images) at 50%?

You can use image_downsize filter and to catch when WordPress wants a downscaled image and not original, and actually a size what doesn’t exist. add_filter( ‘image_downsize’, ‘wpse_60890_retina_scale’, 10, 3 ); function wpse_60890_retina_scale( $value, $id, $size ) { if ( $size == ‘wpse_60890_retina_scaled’ ) { if ( !is_array( $imagedata = wp_get_attachment_metadata( $id ) ) ) return … Read more

Changing the media library default tab

There’s a filter called media_upload_default_tab that you can use to do this. <?php add_filter(‘media_upload_default_tab’, ‘wpse74422_switch_tab’); function wpse74422_switch_tab($tab) { return ‘library’; } You can set the to be whatever — assuming the tab exists. The tab keys themselves are found in the functon media_upload_tabs. <?php /** * Defines the default media upload tabs * * @since … Read more

How to make custom bulk actions work on the media/upload page?

If you want to use your code, try this: If you want to check if the medias are attachments, you can try to use $_REQUEST[‘detached’] add_action( ‘load-upload.php’, ‘export_media_test’ ); function export_media_test() { if ( ! isset( $_REQUEST[‘action’] ) ) return; echo ‘Export Media’; if ( isset( $_REQUEST[‘detached’] ) ) { die( ‘No attachments’ ); } … Read more

Refresh wp.media after ajax call

So, I followed your links and this is working for me. This test works the same for my upload callbacks so hopefully it works for you. In the iframe function myTab_save_frame() { global $redir_tab; $redir_tab = ‘mytab’; media_upload_header(); ?> <button>Test Trigger</button> <script> var switchAndReload = function() { // get wp outside iframe var wp = … Read more

wp media regenerate unknown –image_size parameter

I was able to duplicate the issue when running WP-CLI version 1.1.0, but the command worked successfully when I updated to the nightly build using: wp cli update –nightly The –image-size parameter was added to wp-cli/media-command on April 13, 2017 after the current stable release of WP-CLI v1.1.0 on February 1, 2017. This feature is … Read more