Adding a URL Parameter to JPEG images in posts

function add_jpeg_params($content){

preg_match_all("/https?:\/\/[^\/\s]+\/\S+\.(jpg|jpeg)/", $content, $output_array);

$items_to_replace = array_unique($output_array[0]);
$items_to_replace = array_values($items_to_replace);

for ($j = 0; $j < sizeof($items_to_replace); $j++) {

    $content = str_replace($items_to_replace[$j], $items_to_replace[$j] . '?t=" . time(), $content);
}

return $content;
}
add_filter("the_content','add_jpeg_params',10);
add_filter('post_thumbnail_html', 'add_jpeg_params' );