예제 #1
0
def about(request):

    context = {
        'book': cloudinary.CloudinaryImage('nubian_quest/book.png').build_url(secure=True, quality=40),
        'author': cloudinary.CloudinaryImage('nubian_quest/author.jpg').build_url(secure=True, quality=40),
    }

    return render(request, 'pages/about.html', context)
예제 #2
0
 def cover(self):
     return {
         **{
             size: cloudinary.CloudinaryImage(self.cover_id).build_url(transformation=config.SIZES[size])
             for size in config.SIZES
         },
         'full': cloudinary.CloudinaryImage(self.cover_id).url,
     }
예제 #3
0
def index(request):
    if request.method == 'POST':
        form = SubscriberForm(request.POST)
        if form.is_valid():
            form.save()
            send_mail(
                'New newsletter subscriber',
                f"You have a new subscriber! \n Name: {request.POST['name']} \n Email: {request.POST['email']}.",
                '*****@*****.**',
                ['*****@*****.**', '*****@*****.**']
            )
            return redirect('subscribed')
    else:
        form = SubscriberForm()

        context = {
            'book': cloudinary.CloudinaryImage('nubian_quest/book.png').build_url(secure=True, quality=60),
            'image3': cloudinary.CloudinaryImage('nubian_quest/image3.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image1_original': cloudinary.CloudinaryImage('nubian_quest/image1_original.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image2_original': cloudinary.CloudinaryImage('nubian_quest/image2_original.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image7': cloudinary.CloudinaryImage('nubian_quest/image7.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image4': cloudinary.CloudinaryImage('nubian_quest/image4.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image5': cloudinary.CloudinaryImage('nubian_quest/image5.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'image8': cloudinary.CloudinaryImage('nubian_quest/image8.jpg').build_url(secure=True, quality=60, height=800, crop='fit', fetch_format='auto'),
            'form': form,
        }

        return render(request, 'pages/index.html', context)
예제 #4
0
def get_graph_url(participant_id=None, size=250):
    cloudinary.config(
    cloud_name = "dpn5pmgin",
    api_key = CLOUDINARY_API_KEY,
    api_secret = CLOUDINARY_API_SECRET
    )

    url =""
    if participant_id:
        url=cloudinary.CloudinaryImage(GRAPHS_PATH+'small_graph_'+str(participant_id)+'.png').build_url( width=size, sign_url=True)

    else:
        url = cloudinary.CloudinaryImage(GRAPHS_PATH+'big_graph.png').build_url(sign_url=True)

    return url
예제 #5
0
def my_account(request, userid):
    user = get_object_or_404(User, pk=userid)
    if 'is_logged_in' not in request.session or request.session['is_logged_in'] == False:
        return HttpResponseRedirect(reverse('blog:login'))
    else:
        try:
            all_blogs = user.blogdata_set.all()[0]
        except IndexError:
            return render(request, 'blog/myaccount.html',
                          {'message': "You have not created any blog.Click on Create Blog to create a blog",
                           'user': user})
        if len(user.blogdata_set.filter(published_date=None)) != 0:
            saved_blogs = user.blogdata_set.filter(published_date=None).order_by('-created_date')
            message = 'You have some unpublished blogs'
        else:
            saved_blogs = None
            message = None
        if user.image is not None:
            image_url = cloudinary.CloudinaryImage(user.image).build_url(width=200, height=200, crop='thumb',
                                                                         gravity='face')
        else:
            image_url = None
        published_blogs = user.blogdata_set.exclude(published_date=None).order_by('-published_date')
        return render(request, 'blog/myaccount.html',
                      {'saved_blogs': saved_blogs, 'published_blogs': published_blogs, 'user': user, 'message': message,
                       'image_url': image_url})
예제 #6
0
def get_images_in_one(request):
    group = int(request.query_params['group'])
    picked = get_images_set_list(group)
    images = [Image.objects.get(image_id=id).image for id in picked]
    url = cloudinary.CloudinaryImage(str(images[0])).build_url(
        transformation=[{
            "width": 440,
            "height": 280,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(images[1])),
            "width": 440,
            "height": 280,
            "x": 440,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(images[2])),
            "width": 440,
            "height": 280,
            "y": 280,
            "x": -220,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(images[3])),
            "width": 440,
            "height": 280,
            "y": 140,
            "x": 220,
            "crop": "fill"
        }])
    return Response({"image": url})
예제 #7
0
파일: views.py 프로젝트: Anat37/back-end
def construct_url(img1, img2, img3, img4):
    return cloudinary.CloudinaryImage(str(img1)).build_url(
        transformation=[{
            "width": 440,
            "height": 280,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(img2)),
            "width": 440,
            "height": 280,
            "x": 440,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(img3)),
            "width": 440,
            "height": 280,
            "y": 280,
            "x": -220,
            "crop": "fill"
        }, {
            "overlay": re.sub(r'/', ':', str(img4)),
            "width": 440,
            "height": 280,
            "y": 140,
            "x": 220,
            "crop": "fill"
        }])
예제 #8
0
def pit_scout():
    if event.get_event_id() == -1:
        return redirect(url_for('index'))

    team_no = request.args.get('team_no', None)

    team = db.team.select().where(db.team.team_no == team_no)
    team = list(team.tuples())[0]

    print(team)

    results = db.pit.select(
        db.pit.drivetrain, db.pit.speed, db.pit.fabrication, db.pit.auto,
        db.pit.teleop, db.pit.ball_mech, db.pit.hatch_mech, db.pit.cargo_ship,
        db.pit.rocket, db.pit.climb, db.pit.strategy, db.pit.img_id,
        db.pit.img_ver).where((db.pit.team_no == team_no)
                              & (db.pit.event == event.get_event_id()))

    try:
        results = list(results.tuples())[0]

        img_url = cloudinary.CloudinaryImage(results[11],
                                             version=results[12]).build_url()
    except IndexError:
        results = []
        img_url = ''

    return render_template('pit_scout.html',
                           team=team,
                           results=results,
                           img_url=img_url)
def generate_image(name):
    cloudinary.config(cloud_name="jvss", api_key=KEY, api_secret=SECRET)

    generated_image = cloudinary.CloudinaryImage("diwali.jpg").image(
        transformation=[{
            'effect': "blur:500"
        }, {
            'border': "0px_solid_rgb:ffffff",
            'color': "#ffffff",
            'gravity': "center",
            'overlay': {
                'font_family': "montserrat",
                'font_size': 120,
                'font_weight': "bold",
                'text': "Happy%20Diwali"
            }
        }, {
            'color': "#ffffff",
            'gravity': "south_east",
            'overlay': {
                'font_family': "montserrat",
                'font_size': 60,
                'font_weight': "bold",
                'text': f"%7E%20{name}"
            },
            'x': 30,
            'y': 30
        }])

    return generated_image.split("\"")[1]  # To parse url
예제 #10
0
def overlay(image_url):
    image_size_name = urlparse(image_url).path.split("/")[-1]

    if image_size_name == "maxresdefault.jpg":
        width = "2.0"

    elif image_size_name == "sddefault.jpg":
        width = "1.4"

    elif image_size_name == "hqdefault.jpg":
        width = "1.0"

    elif image_size_name == "mqdefault.jpg":
        width = "0.7"

    elif image_size_name == "default.jpg":
        width = "0.35"

    else:
        width = "1.0"

    overlay = "logos:youtube_logo"

    new_image = cloudinary.CloudinaryImage(image_url).image(secure=True,
                                                            sign_url=True,
                                                            type="fetch",
                                                            overlay=overlay,
                                                            width=width)

    new_image = new_image.lstrip('<img src="')
    new_image = new_image.rstrip('"/>')

    return new_image
예제 #11
0
def dp_request(request):
    user = get_object_or_404(UserProfile, user=request.user)
    if user.passphoto is not None and user.passphoto != "":
        dp = cloudinary.CloudinaryImage(user.passphoto).build_url(
            sign_url=True, format='png', width=0.5, type='authenticated')
    else:
        dp = static('website/images/profilepic.png')
    return dp
예제 #12
0
def get_image_url(full_image_path, size):
    cloudinary.config(
    cloud_name = "dpn5pmgin",
    api_key = CLOUDINARY_API_KEY,
    api_secret = CLOUDINARY_API_SECRET
    )

    url=cloudinary.CloudinaryImage(full_image_path).build_url( width=size, sign_url=True)
    return url
예제 #13
0
def get_cloudinary_image_thumb(key, size):
    cloudinary.config(
    cloud_name = "dpn5pmgin",
    api_key = CLOUDINARY_API_KEY,
    api_secret = CLOUDINARY_API_SECRET
    )

    url=cloudinary.CloudinaryImage(THUMBNAILS_PATH +key+'.jpg').build_url( width=size, sign_url=True)
    return url
예제 #14
0
def saveImageToCloud(image):
    random_hex = secrets.token_hex(8)
    _, ext = os.path.splitext(image.filename)
    image_fn = random_hex + ext

    size = (125, 125)
    i = Image.open(image)
    i.thumbnail(size)
    image_url = Cloud.CloudinaryImage(image_fn)
    return image_url.url
예제 #15
0
 def test_CloudinaryImage_len(self):
     """Tests the __len__ function on CloudinaryImage"""
     metadata = {
         "public_id": "test_id",
         "format": "tst",
         "version": "1234",
         "signature": "5678",
     }
     my_cloudinary_image = cloudinary.CloudinaryImage(metadata=metadata)
     self.assertEqual(len(my_cloudinary_image), len(metadata["public_id"]))
예제 #16
0
def profile():
    my_profile = Shop.query.filter_by(shop_id=current_user.shop_id).first()
    img = Cloud.CloudinaryImage(my_profile.img_path).image()
    print("/////////////// *********** img  is  : " , img)

    User_profile = User.query.filter_by(id=current_user.id).first()
    employees = db.session.query(User).filter(User.shop_id == current_user.shop_id).all()
    employees.remove(employees[0])
    print(employees[0].first_name)
    return render_template('provider/profile.html', my_profile=my_profile, User_profile=User_profile,
                           employees=employees, profile_img=img)
예제 #17
0
    def get_results(self, teams):
        try:
            current_season = Season.objects.get(current='y')
        except Exception as e:
            return ret_message('No season set, see an admin.', True,
                               'PostScoutPitGetResults', self.request.user.id,
                               e)

        try:
            current_event = Event.objects.get(
                Q(season=current_season) & Q(current='y'))
        except Exception as e:
            return ret_message('No event set, see an admin', True,
                               'PostScoutPitGetResults', self.request.user.id,
                               e)

        results = []
        for t in teams:
            if t.get('checked', False):
                team = Team.objects.get(team_no=t['team_no'])
                try:
                    sp = ScoutPit.objects.get(
                        Q(team_no_id=t['team_no']) & Q(event=current_event)
                        & Q(void_ind='n'))
                except Exception as e:
                    return ret_message('No pit data for team.', True,
                                       'PostScoutPitGetResults',
                                       self.request.user.id, e)

                spas = ScoutPitAnswer.objects.filter(
                    Q(scout_pit=sp) & Q(void_ind='n'))

                tmp = {
                    'teamNo':
                    team.team_no,
                    'teamNm':
                    team.team_nm,
                    'pic':
                    cloudinary.CloudinaryImage(sp.img_id,
                                               version=sp.img_ver).build_url(),
                }

                tmp_questions = []
                for spa in spas:
                    sq = ScoutQuestion.objects.get(sq_id=spa.sq_id)
                    tmp_questions.append({
                        'question': sq.question,
                        'answer': spa.answer
                    })

                tmp['results'] = tmp_questions
                results.append(tmp)

        return results
def register_social_profile(backend, user, response, *args, **kwargs):
    try:
        if backend.name == 'facebook':
            if not UserProfile.objects.filter(user=user).exists():
                # Create user profile
                activation_token = uuid.uuid4()
                p = UserProfile(id=None, user=user,
                                picture=cloudinary.CloudinaryImage("sample", format="png"), user_type='P',
                                activation_token=activation_token)
                p.save()
    except Exception as e:
        print(e)
예제 #19
0
def vectorize(filename="", detail=0.5, corners=5, colors=1, public_id=None):
    if public_id is None:
        result = uploader.upload(filename, width=512, height=512, crop='limit')
        public_id = result['public_id']
        print(f"Public key: {public_id}, url: {result['secure_url']}")
    svg_image = cloudinary.CloudinaryImage(public_id).image(
        effect=f"vectorize:"
        f"detail:{detail}"
        f":corners:{corners}"
        f":colors:{colors}")
    file_url = svg_image[10:-3] + '.svg'
    svg_file = requests.get(file_url).text
    svg_file = svg_file[svg_file.find("<g>") + 3:svg_file.rfind("</g>")]
    return svg_file
예제 #20
0
def get_customer_internal(user_id, is_corporate):
    db = ApiAccess.get_revenyou_db().corporate_account if is_corporate \
        else ApiAccess.get_revenyou_db().sign_up
    cursor = list(db.find({'user_id': user_id}))
    if len(cursor) == 0:
        return {}

    user = cursor[0]
    carrier_id = user.get('carrier_id', None)
    country = user.get('country', None)
    carrier = ApiAccess.get_revenyou_db().carrier.find_one(
        {'_id': ObjectId(carrier_id)}) if carrier_id is not None else {}
    country = pycountry.countries.get(
        alpha_3=country.upper()) if country is not None else None
    user['mobile'] = carrier.get('non_formated_phone_number',
                                 '') if carrier else ''
    user['_id'] = str(user['_id'])
    user['country'] = country.name if country is not None else 'Unknown'
    user['date_added'] = utils.utc_ts_to_local_str(user.get(
        'date_added', None))
    user['date_modified'] = utils.utc_ts_to_local_str(
        user.get('date_modified', None))
    user['full_name'] = '{} {}'.format(user.get('first_name', ''),
                                       user.get('last_name', ''))

    try:
        if 'document_front_url' in user:
            user['document_front_url'] = cloudinary.CloudinaryImage(
                user['document_front_url']).build_url()
        if 'document_back_url' in user:
            user['document_back_url'] = cloudinary.CloudinaryImage(
                user['document_back_url']).build_url()
    except Exception:
        pass

    return user
def register(request):
    if request.user.is_authenticated():
        messages.warning(request, "You are already logged in.")
        return HttpResponseRedirect(reverse('home'))

    if request.method == 'POST':
        form = RegistrationForm(request.POST)

        if not form.is_valid():
            return render(request, "users/register.html", {'form': form})
        else:
            form.instance.is_active = False
            new_user = form.save()

            activation_token = uuid.uuid4()
            user_category = form.cleaned_data["user_type"]
            p = UserProfile(id=None, user=new_user,
                            picture=cloudinary.CloudinaryImage("sample", format="png"), user_type=user_category,
                            activation_token=activation_token)
            p.save()

            if form.cleaned_data["user_type"] == "D":
                developers = Group.objects.get(name='developers')
                developers.user_set.add(p.user)
            else:
                players = Group.objects.get(name='players')
                players.user_set.add(p.user)

        mail_title = 'Confirm your subscription!'
        message = 'Please visit the following link to complete your subscription: .... %s' % \
                  request.build_absolute_uri(reverse(viewname='activate', args=(activation_token,)))

        new_user.email_user(mail_title, message)

        messages.success(request=request, message='You have correctly registered to our portal. '
                                                  'An activation mail has been sent to your email account. '
                                                  'To log in, you will need to activate yourself by clicking '
                                                  'the activation link provided into that email.')
        return HttpResponseRedirect(reverse("index"))

    if request.method == 'GET':
        form = RegistrationForm()
        return render(request, "users/register.html", {
            'form': form,
        })
예제 #22
0
def edit_profile():
    form = EditShopProfile()
    # form_action= url_for('mod_provider.edit_profile')
    User_profile = User.query.filter_by(id=current_user.id).first()
    profile = Shop.query.filter_by(shop_id=current_user.shop_id).first()
    img = Cloud.CloudinaryImage(profile.img_path).image()
    if form.validate_on_submit():
        print("validated")
        try:
            profile.shop_name = form.shop_name.data
            profile.location = form.location.data
            User_profile.email = form.email.data
            User_profile.last_name = form.lastname.data
            User_profile.first_name = form.firstname.data
            User_profile.phone_number = form.phone_number.data

            f = form.image.data
            if f is not None:
                uploaded = upload(f)
                print(uploaded['public_id'])
            else:
                uploaded = upload(f)
                print(uploaded['public_id'])

            profile.img_path = uploaded['public_id']
            db.session.commit()
            flash('Profile Updated')
        except IntegrityError as IE:
            db.session.rollback()
            app.logger.error('Error editing shop: %s', IE)

        return redirect(url_for("mod_provider.profile"))

    if request.method == 'GET':
        form.shop_name.data = profile.shop_name
        form.location.data = profile.location
        form.email.data = User_profile.email
        form.lastname.data = User_profile.last_name
        form.firstname.data = User_profile.first_name
        form.phone_number.data = User_profile.phone_number
        form.image.data = profile.img_path

    return render_template('provider/edit_profile.html', form=form, profile=profile, User_profile=User_profile,
                           profile_img=img)
예제 #23
0
 def fetch_transformed_cloudinary_img(self, source, transformations):
     img_url = cloudinary.CloudinaryImage(source).build_url(
         transformation=transformations)
     try:
         response = requests.get(img_url)
         response.raise_for_status()
     except requests.exceptions.HTTPError as errh:
         print(f"Http Error: {errh}")
         return [response.status_code, response.reason]
     except requests.exceptions.ConnectionError as errc:
         print(f"Error Connecting: {errc}")
         return [response.status_code, response.reason]
     except requests.exceptions.Timeout as errt:
         print(f"Timeout Error: {errt}")
         return [response.status_code, response.reason]
     except requests.exceptions.RequestException as err:
         print(f"OOps: Something Else {err}")
         return [response.status_code, response.reason]
     else:
         return img_url
예제 #24
0
def myAccount(request, user_id):
    user = get_object_or_404(User, pk=user_id)
    form = UpdateForm()
    if 'is_logged_in' not in request.session or request.session[
            'is_logged_in'] == False:
        return HttpResponseRedirect(reverse('discuss:login'))
    else:
        logged_user = user.username
        if user.image is not None:
            image_url = cloudinary.CloudinaryImage(user.image).build_url(
                width=200, height=200, crop='thumb', gravity='face')
        else:
            image_url = None
        return render(
            request, 'discuss/myaccount.html', {
                'user': user,
                'image_url': image_url,
                'logged_user': logged_user,
                'form': form
            })
예제 #25
0
def dashboard(request):
    image = cloudinary.CloudinaryImage("UI/user.png")
    user = auth.get_user(request)
    reservation_list = Reservation.objects.filter(user_id=user.id)
    giveout_list = GiveOut.objects.filter(user_id=user.id)
    giveout_log_list = GiveOutLogEntry.objects.filter(user_id=user.id)
    request_list = DocumentRequest.objects.filter(user_id=user.id)

    return render(
        request,
        'dashboard.html',
        context={
            'patron_user': user,
            'reservation_table': reservation_list,
            'giveout_table': giveout_list,
            'giveout_log_table': giveout_log_list,
            'request_table': request_list,
            'image': image
        },
    )
예제 #26
0
    def get(self, request):
        user_id = request.GET.get('userId')
        user = User.objects.filter(pk=user_id).first()

        if user:
            if user.image is None:
                image_url = "http://res.cloudinary.com/doppel/image/upload/c_thumb,g_face,h_200,r_max,w_200/v1481639812/home-user-icon_je9kjh.png"
            else:
                image_url = cloudinary.CloudinaryImage(user.image).build_url(width=200, height=200, crop='thumb',
                                                                             gravity='face')

            payload = UserSerializer(instance=user).data

            json = {
                'user': payload,
                'imageURL': image_url
            }

            return Response(json, status=status.HTTP_200_OK)
        else:
            return Response({'message': 'User not found'}, status=status.HTTP_404_NOT_FOUND)
예제 #27
0
def get_token():
    # get the post data
    data = request.json or request.data or request.form
    # check if user already exists
    email = data.get("email")
    faculty = Faculty.query.filter_by(email=email).first()
    if faculty:
        try:
            password = data.get("password")
            if bcrypt.check_password_hash(faculty.password, password):
                image = faculty.image
                if image and "/image/upload/" in image:
                    url = faculty.image.split("/image/upload/")[1]
                    url = "/".join(url.split("/")[1:]) if url else url
                    image = cloudinary.CloudinaryImage(url).build_url(
                        transformation=[{"width": 150, "height": 150},]
                    )
                res = {
                    "status": "success",
                    "message": "log in successful.",
                    "auth_token": faculty.encode_auth_token(email).decode(),
                    "is_admin": faculty.admin,
                    "name": faculty.name,
                    "profile_image": image,
                }
                return jsonify(res), 202
        except Exception as e:
            print(str(e))
            res = {
                "status": "fail",
                "message": "Some error occurred. Please try again.",
            }
            return jsonify(res), 401

    res = {
        "status": "fail",
        "message": "Username or password is incorrect.",
    }
    return jsonify(res), 401
예제 #28
0
def cloudinaryImage(upperText,lowerText,imageInput):
    tr=[]
    if upperText != "-" and upperText != "_":
        upperText = upperText.replace(" ","%20")
        tr.append({"overlay": "text:Roboto_40_bold_letter_spacing_5:"+upperText, "y":30, "gravity":"north","color":"#ffffff"})
    if lowerText!="-" and lowerText!="_":
        lowerText = lowerText.replace(" ","%20")
        tr.append({"overlay": "text:Roboto_40_bold_letter_spacing_5:"+lowerText, "y":30, "gravity":"south","color":"#ffffff"})
    #sample pload
    try: 
        data = upload(imageInput)
    except:
        data = upload(imageInput)
    #it return dictionary 
    #use public_id to access and manipulate going forward
    public_id = data['public_id']
	#also extract format, whether it is  jpg or png
    img_format = data['format']
    img = cloudinary.CloudinaryImage(public_id).image(transformation=tr)
    url = img[10:-3]+"."+img_format
    print(url)
    return url
예제 #29
0
def myid(page_id):
    secret_token_results = request.headers.get('Authorization')
    print("results", current_user.id)
    testing = db.session.query(Tests).filter(Tests.id == page_id).first()
    print(testing)
    print("aaaa", testing.id, testing.user_id, testing.product_page)
    # get screenshots from cloudinary

    type_payment_info = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/type-payment-info{page_id}.png")
    click_checkout_button = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/click-checkout-button{page_id}.png")
    personal_info_image = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/person-information{page_id}.png")
    add_tocart_image = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/add-to-cart{page_id}.png")
    click_payment_button_image = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/clickpaymentbutton{page_id}.png")
    product_page_image = Cloud.CloudinaryImage(
        f"my_folder/{current_user.id}/product-page{page_id}.png")

    # print(testing_image_url)
    return jsonify({
        "id": testing.id,
        "product_page": testing.product_page,
        "add_to_cart": testing.add_to_cart,
        "go_to_checkout": testing.go_to_checkout,
        "payment_info": testing.payment_info,
        "payment_button": testing.payment_button,
        "personal_info": testing.personal_info,
        "personal_info_image": personal_info_image.url,
        "add_to_cart_image": add_tocart_image.url,
        "payment_page_image": click_payment_button_image.url,
        "product_page_image": product_page_image.url,
        "type_payment_image": type_payment_info.url,
        "click_checkout_image": click_checkout_button.url
    })
예제 #30
0
def upload_image(file, **options):
    result = upload(file, **options)
    return cloudinary.CloudinaryImage(result["public_id"],
                                      version=str(result["version"]),
                                      format=result.get("format"),
                                      metadata=result)