[u]โค้ดตัวอย่างการโชว์รูปภาพ[/u]
โค้ด: เลือกทั้งหมด
import base64
fee = os.listdir("images")
image_aa = ''
print fee
for fill in fee:
image = open('/home/com003/PycharmProjects/test_project/work01/images/'+fill, 'rb') open binary file in read mode
image_read = image.read()
image_64_encode = base64.encodestring(image_read)
image_aa += '''<img src="data:image/png;base64,''' + image_64_encode + '''" wicth="300" hight="200">'''
return BaseResponse(image_aa, mimetype='text/html')