ciao a tutti, usa la seguente funzione x trasformare un url in un link cliccabile

Codice PHP:
function hyperlink($text) {
  
$text preg_replace("/(((http|https)\:\/\/){1}\S+)/","[url='$1']link[/url]",$text);
  return 
$text;

vorrei pero che la preg_replace escludesse link a immagini del tipo

http://www.sito.it/img/img1.gif
http://www.sito.it/img/img1.png
http://www.sito.it/img/img1.jpg