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 photo(request):
    """
    Show infomation of photo. Don't check the p_id temporary
    """
    latest_tag_list = dbControl.get_latest_tags()
    email = common.get_email(request)
    p_id = int(request.GET['photo'])
    if request.user.is_authenticated():
        is_collected = dbControl.is_collected(email, p_id)
    else:
        is_collected = False
    photo_info = dbControl.get_photo_info(p_id, method='p_id')
    return_dict = {'user_Email': email,
                  'latest_tag_list': latest_tag_list,
                  'is_collected': is_collected,
                  'photo_info': photo_info}
    return render(request, 'photo.html', return_dict)