This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.files.uploadedfile import InMemoryUploadedFile | |
import StringIO | |
def MakeThumbnail(file): | |
img = Image.open(file) | |
img.thumbnail((128, 128), Image.ANTIALIAS) | |
thumbnailString = StringIO.StringIO() | |
img.save(thumbnailString, 'JPEG') | |
newFile = InMemoryUploadedFile(thumbnailString, None, 'temp.jpg', 'image/jpeg', thumbnailString.len, None) | |
return newFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import _mysql | |
import sys | |
try: | |
con = _mysql.connect('localhost', 'testuser', '123456', 'testdb') | |
con.query('select version()') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
import sys | |
try: | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb') | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb'); | |
with con: | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb'); | |
with con: | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', 'test623', 'testdb'); | |
with con: | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb') | |
with con: | |
cur = con.cursor(mdb.cursors.DictCursor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', '123456', 'testdb') | |
with con: | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
con = mdb.connect('localhost', 'testuser', 'test623', 'testdb') | |
with con: | |
cur = con.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import MySQLdb as mdb | |
def read_image(): | |
fin = open("woman.jpg") | |
img = fin.read() |
OlderNewer