使用php将图像文件存储到SQL Server

I have a SQL Server table with a column called personal image with image data type.

I want to insert or update this field using PHP sqlsrv extension.

I have that image file for update query and i try this but the image not inserted correctly.

function prepareImageDBString($filepath)
{
    $out = 'null';
    $handle = @fopen($filepath, 'rb');
    if ($handle)
    {
        $content = @fread($handle, filesize($filepath));
        $content = bin2hex($content);
        @fclose($handle);
        $out = "0x".$content;
    }
    return $out;
}

$out = prepareImageDBString('871190915.jpg');

$update = "UPDATE Person SET PersonelImage=(?) WHERE no=871190915";
$image1=array($out);
sqlsrv_query($conn, $update, $image1);

Can anyone help me?