将图像保存到数据库中

I'm trying to save images in a mysql database. It saves binary code into the table, but its corrupt and i can't display it. Also the size of the database field is bigger than the original file. Is there anything wrong in my code or in the approach im having.

I know thats its not a good practice to store images in a database, but im not in the position to decide it.

  <div class="box-body">
             <h3>Bilder</h3>
              <form id="image_form">
                   <input type="file" name="frame" id="file_name" />
                   <input type="submit" value="Save">
               </form>
     </div>

 $('#image_form').on("submit",(function (e) {
            e.preventDefault();
            $.ajax({
                type: 'POST',
                url: './index.php?action=585',
                data: new FormData(this),
                contentType: false,
                cache: false,
                processData: false,
                beforeSend: function (a) {
                    //a.overrideMimeType('image/jpeg; charset=UTF-8');
                },
                success: function (data) {
                    console.log(data);
                },
                error: function () {
                    location.reload();
                }
            });
        }));

Back-End

//Get the content of the image and then add slashes to it
$tmpName = $_FILES['frame']['tmp_name'];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);

var_dump($data);

$imagetmp = $data;

AccountDAO::updateResImages($imagetmp, $imagetmp, $imagetmp, $_SESSION['customer']->id);

Database

public static function updateResImages($img1, $img2, $img3, $customerid){
    $db = new MySQLDatabase();
    $sql = "UPDATE customer SET online_res_bild1 = ?, online_res_bild2 = ?, online_res_bild3 = ? WHERE customer_id = ? ";
    $rs = $db->executeQuery($sql, 'sssi', $img1, $img2, $img3, $customerid);
    $db->close();
    return 1;
}