@@ -60,9 +60,9 @@ public function after_user_init() {
6060 add_action ('delete_attachment ' , array ( $ this , 'delete_attachment ' ), 11 , 2 );
6161
6262 // For big images, allow to replace original with scaled image.
63- if ( $ this ->conf (Base::O_MEDIA_REP_W_SCALED ) ){
63+ if ( $ this ->conf (Base::O_MEDIA_AUTO_RESCALE_ORI ) ){
6464 // Added priority 9 to happen before other functions added.
65- add_filter ('wp_update_attachment_metadata ' , array ( $ this , 'replace_original_with_scaled ' ), 9 , 2 );
65+ add_filter ('wp_update_attachment_metadata ' , array ( $ this , 'rescale_ori ' ), 9 , 2 );
6666 }
6767 }
6868
@@ -107,19 +107,19 @@ public function init() {
107107
108108 /**
109109 * Handle attachment create
110- *
110+ *
111111 * @param array $metadata Current meta array.
112112 * @param int $attachment_id Attachment ID.
113113 * @return array $metadata
114114 * @since 7.4
115115 */
116- public function replace_original_with_scaled ( $ metadata , $ attachment_id ) {
116+ public function rescale_ori ( $ metadata , $ attachment_id ) {
117117 // Test if create and image was resized.
118118 if ( $ metadata && isset ($ metadata ['original_image ' ]) && isset ($ metadata ['file ' ]) && false !== strstr ($ metadata ['file ' ], '-scaled ' )){
119119 // Get rescaled file name.
120120 $ path_exploded = explode ( '/ ' , strrev ($ metadata ['file ' ]), 2 );
121121 $ rescaled_file_name = strrev ($ path_exploded [0 ]);
122-
122+
123123 // Create paths for images: resized and original.
124124 $ base_path = $ this ->_wp_upload_dir ['basedir ' ] . $ this ->_wp_upload_dir ['subdir ' ] . '/ ' ;
125125 $ rescaled_path = $ base_path . $ rescaled_file_name ;
0 commit comments