Example #1
0
def upload_photo(photo_file, description, tag, permission, owner):
    # upload photo
    photo_url = storage.obj_upload(photo_file, tag)
    thumbnail_url = get_thumbnail_url(
        photo_url, size='c_fit,w_750')
    # add face to faceset
    person_id_list = faceControl.add_faces(
            method='url', url_or_path=thumbnail_url)
    # save photo and tags
    dbControl.save_photo_and_tag(
        photo_url, description, tag, person_id_list, permission, owner)
    # save info
    photo_info = dbControl.get_photo_info(photo_url, method='url')
    return photo_info
Example #2
0
 def test_add_face(self):
     got_person_list = faceControl.add_faces(
         'url', 'http://cdn.sinacloud.net/sharephotos/%E5%A5%A5%E5%B7%B4%E9%A9%AC%E3%80%81%E7%B1%B3%E6%AD%87_Mon_Apr_18_00%3A16%3A01_2016.jpg')
     # It's a photo with two persons, so the length is 2.
     self.assertEqual(len(got_person_list), 2)