preg_match
expects its regex argument to be within a pair delimiters.
So try:
if ( ! preg_match("#convert$#i", $this->library_path)) {
if ( ! preg_match("#/$#i", $this->library_path))
$this->library_path .= "https://stackoverflow.com/";
$this->library_path .= 'convert';
}
if (preg_match("#gd2$#i", $protocol)) {
$protocol="image_process_gd";
}