3.5 media.editor: what is the event listener for choosing an image?

Found out that overriding some of the wp.media.editor objects methods is the best solution, because it allows you to customize the event handling, but will also preserve a lot of the backend processing and handling that WP has in place for processing images. I basically overrode wp.media.editor.send.attachment, wp.media.gallery.shortcode with my own methods, and wp.media.editor.remove, in … Read more

Generated media have incorrect aspect ratio

Under settings >> media, change the height attributes to 9999, and untick Crop thumbnail to exact dimensions (normally thumbnails are proportional) under the thumbnail size if it is ticked. When you are done, download and install “Force Regenerate Thumbnails”. This is actually better than “Regenerate Thumbnails” as it deletes all redundant image sizes.

Organizing media uploads

First, I assume the problem isn’t as much 1M files, but your server unable to handle it? Logically it worked elsewhere, right? My opinion is that presenting is as a “problem” to the client might be a little one sided. It’s in realm of technical possibility, but it won’t be a smooth process. WP stores … Read more

Different upload path per file type

Change upload directory for PDF Files seems to be a good stepping stone forward. Although untested, looking at the code my adaptation would be along the lines of… <?php add_filter(‘wp_handle_upload_prefilter’, ‘custom_media_library_pre_upload’); add_filter(‘wp_handle_upload’, ‘custom_media_library_post_upload’); function custom_media_library_pre_upload($file){ add_filter(‘upload_dir’, ‘custom_media_library_custom_upload_dir’); return $file; } function custom_media_library_post_upload($fileinfo){ remove_filter(‘upload_dir’, ‘custom_media_library_custom_upload_dir’); return $fileinfo; } function custom_media_library_custom_upload_dir($path){ $extension = substr(strrchr($_POST[‘name’],’.’),1); if ( !empty( … Read more

Disable mouse image resizing in editor

I use a lot of CSS to manipulate things in the WP UI. I have this in a plugin – should work as expected. If you are already hooked into the admin CSS then bypass the filter. PHP add_filter (‘admin_enqueue_scripts’, array(&$this, ‘load_custom_wp_admin_style’ )); function load_custom_wp_admin_style() { echo ‘<style type=”text/css” rel=”stylesheet-default-admin”> @import url(‘.WPMSGC_URL.’/assets/css/default-admin.css);’ . $this->options[‘default_admin_css’] . … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)