Last active
May 19, 2017 12:50
-
-
Save BhargavBhandari90/a77db6ed73e6c96bbba4c2f8bd7066b2 to your computer and use it in GitHub Desktop.
Remove the random number from the transcoded filename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this function to theme's functions.php | |
* Remove the random number from the transcoded filename | |
* | |
* @param string $tempname Transcoded file's temporary name. | |
* @return string $tempname Updated filename. | |
*/ | |
function rtmc_transcoded_temp_filename( $tempname ) { | |
if ( class_exists( 'RT_Transcoder_Admin' ) ) { | |
// Divide the name from "-". | |
$filename_arr = explode( '-', $tempname ); | |
// Gets the removable part from filename. | |
$start_pos = strlen( $filename_arr[0] ); | |
// Removes the number from filename. | |
$tempname = substr( $tempname, $start_pos + 1 ); | |
} | |
return $tempname; | |
} | |
add_filter( 'transcoded_temp_filename', 'rtmc_transcoded_temp_filename' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Replace this line
https://github.com/rtMediaWP/transcoder/blob/master/admin/rt-transcoder-handler.php#L723
with
$thumbinfo['basename'] = apply_filters( 'transcoded_temp_filename', $temp_name );