How do I add a customized parameter to image links Lets say I have image fields in my node. When I get that fields values in the twig it returns the image URL without any issue. 

file_url(node.field_image.entity.uri.value)


But now I want to add a specific parameter (lets say ?param=0) to the end of that link. Without hard coding the parameter in the twig file is there a way to write a hook that adds that parameter for all the image links in every node. So if I have to change the param I only need to change it from one place.
You can do this with a preprocess function THEMENAME_preprocess_field and check whether the field is an image and it has a URL

function THEMENAME_preprocess_field(&amp;$variables) {
  if($variables["element"]["#field_type"] == "image"){
    if(isset($variables["items"][0]["content"]["#url"])){
      $variables["items"][0]["content"]["#url"]-&gt;setOption('query', ['param' =&gt; '0']);
    }
  }
}