Limit WordPress Image Upload Size

function ter_limit_image_uploads($file){
$error_message = 'KB is to large. Please reduce the file size of your image to ' . TER_MAX_IMAGE_SIZE_KB . 'KB or less. Hosting space is limited and uploading large images will slow down your page loads. Use a tool such as to help you to resize your images. Target size: Width 1024px, file size 100KB-200KB';
$size_in_kb = $file['size'] / 1024;
if(preg_match('/image/',$file['type'])) if($size_in_kb > TER_MAX_IMAGE_SIZE_KB) $file['error'] = round($size_in_kb,2) . $error_message;
return $file;
add_filter('wp_handle_upload_prefilter','ter_limit_image_uploads'); //Limit uploaded image size

Add page specific javascript from plugin

//add jquery plugins for specific page
add_action( "template_redirect", "check_to_enqueue_scripts" ) );

//function to check if propose-trade page then enqueue scripts
function check_to_enqueue_scripts(){
if( is_page( 338 ) ){
add_action('wp_enqueue_scripts', "enqueue_plugin_scripts" );
//function to enqueue my page specific scripts
function enqueue_plugin_scripts(){