def _check_image_size(ifile):
    """ make sure we don't load humongo images """
    from PIL import Image
    img = Image.open(ifile)
    basewidth = 250
    if img.size[0] > basewidth or img.size[1] > basewidth:
        print('checking image (' + ifile + ') size --> ' + str(img.size))
        wpercent = basewidth / float(img.size[0])
        hsize = int(float(img.size[1]) * float(wpercent))
        img = img.resize((basewidth, hsize), Image.ANTIALIAS)
        img.save(ifile)
