Skip to content

Instantly share code, notes, and snippets.

@BhargavBhandari90
Last active May 19, 2017 12:50
Show Gist options
  • Save BhargavBhandari90/a77db6ed73e6c96bbba4c2f8bd7066b2 to your computer and use it in GitHub Desktop.
Save BhargavBhandari90/a77db6ed73e6c96bbba4c2f8bd7066b2 to your computer and use it in GitHub Desktop.
Remove the random number from the transcoded filename
<?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' );
@BhargavBhandari90
Copy link
Author

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment