Ticket #21959: media_destination_file_name_hook.diff

File media_destination_file_name_hook.diff, 707 bytes (added by jkmassel, 8 months ago)

A fix for this issue

  • wp-includes/media.php

     
    453453        if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) ) 
    454454                $dir = $_dest_path; 
    455455        $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}"; 
    456  
     456         
     457        $destfilename = apply_filters('image_resize_set_file_name', array( 
     458                'proposed_file_path' => $destfilename, 
     459                'suffix' => $suffix, 
     460                'extension' => $ext, 
     461                'original' => $file 
     462        )); 
     463         
    457464        if ( IMAGETYPE_GIF == $orig_type ) { 
    458465                if ( !imagegif( $newimage, $destfilename ) ) 
    459466                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));