Is is possible to crop an image after uploading

Untested, but I believe this should work: jQuery(document).ready(function (){ jQuery(“.select-image”).click(function() { var custom_uploader = wp.media({ title: ‘Selecteer een afbeelding’, button: { text: ‘Selecteer’ }, multiple: false }); custom_uploader.on(‘select’, function() { custom_uploader.Jcrop(); }); custom_uploader.open(); }); });

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

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

What is the best practice for renaming WordPress media files?

As Rarst has explained, you can’t really directly edit your database, or you’ll risk killing the serialized data. Your options are thus to: delete the file and re-upload it with its new name (obviously has the downside of having to reinsert it everywhere it was being used), or to use one of the media renaming … Read more

display image size in media library screen

Code based on Custom Sortable Columns add_filter(‘manage_upload_columns’, ‘size_column_register’); function size_column_register($columns) { $columns[‘dimensions’] = ‘Dimensions’; return $columns; } add_action(‘manage_media_custom_column’, ‘size_column_display’, 10, 2); function size_column_display($column_name, $post_id) { if( ‘dimensions’ != $column_name || !wp_attachment_is_image($post_id)) return; list($url, $width, $height) = wp_get_attachment_image_src($post_id, ‘full’); echo esc_html(“{$width}&times;{$height}”); }

Filter for changing MediaElement.js Settings

Copy wp-includes/js/mediaelement/wp-mediaelement.js into your theme or plugin and make your modifications there. For example, I added some settings to force the use of native video controls on iOS & Android devices, like so: (function ($) { // add mime-type aliases to MediaElement plugin support mejs.plugins.silverlight[0].types.push(‘video/x-ms-wmv’); mejs.plugins.silverlight[0].types.push(‘audio/x-ms-wma’); $(function () { var settings = { // Put … Read more