How to store pictures into the SQL Server database?

xiaoxiao2021-03-06  95

Deposit:

First, the picture file is first read in a binary manner to store a variable.

$ IMGNAME = "Image File Name";

$ fp = fopen ($ IMGNAME, "RB");

$ bit = fread ($ FP, FileSize);

Fclose ($ fp);

Calculate this variable with Base_Encode

$ bit = base64_encode ($ bit);

Introduction

************

Output:

Read from the library to $ bit;

$ bit = base64_decode ($ bit);

Header ("Content-Type: Image / GIF"); // Other types of pictures to change here

Echo $ bit;

转载请注明原文地址:https://www.9cbs.com/read-122098.html

New Post(0)