Media File Renamer - Version 5.3.5

Version Description

(2021/11/10) = * Fix: Renaming of WebP uploaded directly to WordPress. * Add: The possibility of locking files automatically after a manual rename (which was always the case previously), and/or after a automatic rename (that was not possible previously). With this last option, users having trouble to "Rename All" will be given the choice to do it on any kind of server. You will find those options in the Advanced tab. * Add: "Delay" option, to give a break and a reset to the server between asynchronous requests! Default to 100ms. That will avoid the server to time out, or to slow down on purpose. * Note: This plugin is a lot of work. If you like it, please write a little review by clicking here. Thank you :)

Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media File Renamer
Version 5.3.5
Comparing to
See all releases

Code changes from version 5.3.4 to 5.3.5

Files changed (3) hide show
  1. classes/core.php +17 -6
  2. media-file-renamer.php +2 -2
  3. readme.txt +3 -2
classes/core.php CHANGED
@@ -824,10 +824,12 @@ SQL;
824
  $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url, 'full' );
825
  if ( !empty( $meta['sizes'] ) ) {
826
  foreach ( $meta['sizes'] as $size => $meta_size ) {
827
- $orig_image_url = $orig_image_urls[$size];
828
- $new_image_data = wp_get_attachment_image_src( $id, $size );
829
- $new_image_url = $new_image_data[0];
830
- $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url, $size );
 
 
831
  }
832
  }
833
  }
@@ -1114,8 +1116,17 @@ SQL;
1114
  }
1115
 
1116
  function rename_alternative_image_formats( $old_filepath, $old_ext, $new_finepath, $new_ext, $case_issue, $force_rename, $post ) {
1117
- $this->rename_alternative_image_format( '.webp', $old_filepath, $old_ext, $new_finepath, $new_ext, $case_issue, $force_rename, $post );
1118
- $this->rename_alternative_image_format( '.avif', $old_filepath, $old_ext, $new_finepath, $new_ext, $case_issue, $force_rename, $post );
 
 
 
 
 
 
 
 
 
1119
  }
1120
 
1121
  /**
824
  $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url, 'full' );
825
  if ( !empty( $meta['sizes'] ) ) {
826
  foreach ( $meta['sizes'] as $size => $meta_size ) {
827
+ if ( isset( $orig_image_urls[$size] ) ) {
828
+ $orig_image_url = $orig_image_urls[$size];
829
+ $new_image_data = wp_get_attachment_image_src( $id, $size );
830
+ $new_image_url = $new_image_data[0];
831
+ $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url, $size );
832
+ }
833
  }
834
  }
835
  }
1116
  }
1117
 
1118
  function rename_alternative_image_formats( $old_filepath, $old_ext, $new_finepath, $new_ext, $case_issue, $force_rename, $post ) {
1119
+ $isWebP = ( $old_ext === 'webp' || $new_ext === 'webp' );
1120
+ $isAvif = ( $old_ext === 'avif' || $new_ext === 'avif' );
1121
+
1122
+ if ( !$isWebP ) {
1123
+ $this->rename_alternative_image_format( '.webp', $old_filepath, $old_ext, $new_finepath,
1124
+ $new_ext, $case_issue, $force_rename, $post );
1125
+ }
1126
+ if ( !$isAvif ) {
1127
+ $this->rename_alternative_image_format( '.avif', $old_filepath, $old_ext, $new_finepath,
1128
+ $new_ext, $case_issue, $force_rename, $post );
1129
+ }
1130
  }
1131
 
1132
  /**
media-file-renamer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Media File Renamer
4
  Plugin URI: https://meowapps.com
5
  Description: Renames your media files for better SEO and a nicer filesystem (automatically or manually).
6
- Version: 5.3.4
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-file-renamer
@@ -15,7 +15,7 @@ Originally developed for two of my websites:
15
  */
16
 
17
  if ( !defined( 'MFRH_VERSION' ) ) {
18
- define( 'MFRH_VERSION', '5.3.4' );
19
  define( 'MFRH_PREFIX', 'mfrh' );
20
  define( 'MFRH_DOMAIN', 'media-file-renamer' );
21
  define( 'MFRH_ENTRY', __FILE__ );
3
  Plugin Name: Media File Renamer
4
  Plugin URI: https://meowapps.com
5
  Description: Renames your media files for better SEO and a nicer filesystem (automatically or manually).
6
+ Version: 5.3.5
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-file-renamer
15
  */
16
 
17
  if ( !defined( 'MFRH_VERSION' ) ) {
18
+ define( 'MFRH_VERSION', '5.3.5' );
19
  define( 'MFRH_PREFIX', 'mfrh' );
20
  define( 'MFRH_DOMAIN', 'media-file-renamer' );
21
  define( 'MFRH_ENTRY', __FILE__ );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://meowapps.com/donation/
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.0
8
- Stable tag: 5.3.4
9
 
10
  Renames your media files for better SEO and a nicer filesystem (automatically or manually).
11
 
@@ -67,7 +67,8 @@ The plugin can be tweaked in many ways, there are many actions and filters avail
67
 
68
  == Changelog ==
69
 
70
- = 5.3.4 (2021/11/09) =
 
71
  * Add: The possibility of locking files automatically after a manual rename (which was always the case previously), and/or after a automatic rename (that was not possible previously). With this last option, users having trouble to "Rename All" will be given the choice to do it on any kind of server. You will find those options in the Advanced tab.
72
  * Add: "Delay" option, to give a break and a reset to the server between asynchronous requests! Default to 100ms. That will avoid the server to time out, or to slow down on purpose.
73
  * Note: This plugin is a lot of work. If you like it, please write a little review [by clicking here](https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post). Thank you :)
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.0
8
+ Stable tag: 5.3.5
9
 
10
  Renames your media files for better SEO and a nicer filesystem (automatically or manually).
11
 
67
 
68
  == Changelog ==
69
 
70
+ = 5.3.5 (2021/11/10) =
71
+ * Fix: Renaming of WebP uploaded directly to WordPress.
72
  * Add: The possibility of locking files automatically after a manual rename (which was always the case previously), and/or after a automatic rename (that was not possible previously). With this last option, users having trouble to "Rename All" will be given the choice to do it on any kind of server. You will find those options in the Advanced tab.
73
  * Add: "Delay" option, to give a break and a reset to the server between asynchronous requests! Default to 100ms. That will avoid the server to time out, or to slow down on purpose.
74
  * Note: This plugin is a lot of work. If you like it, please write a little review [by clicking here](https://wordpress.org/support/plugin/media-file-renamer/reviews/?rate=5#new-post). Thank you :)