2022년 7월 26일 화요일

mssql insert image

 def insert(self, file_id, file_path):


    img = Image.open(file_path)

    w = int(img.width / 2)

    h = int(img.height / 2)

    img_resize = img.resize((w, h))

    img_resize.save('./temp.png')


    with open('./temp.png', 'rb') as fh:

        bindata = fh.read()

        buf = '0x' + binascii.hexlify(bindata).decode('ascii')

        query = f"INSERT INTO {self.tablename}(FILE_ID, FILE_DATA) VALUES ({file_id}, {buf})"

    self.cursor.execute(query)

    self.conn.commit()

[python] subprocess

proc.py import asyncio from argparse import ArgumentParser from asyncio import sleep async def process_function(user, file_path):     if use...