Not able to present Google user image insde Google workspace addon - google-cloud-platform

I'm working on a Google Workspace Addon using TS & Express.
When trying to display an image coming from my CDN, I see that google caches/proxies it via its own URL
i.e
https://www.lorempixel.com/400/400
turns into
https://ci3.googleusercontent.com/proxy/1A6QM0...bvtAcYz6o8U7e622Nu7Uq4=s40
But when trying to present an image that's coming from Google (i.e google account image), it's not proxied, and the actual URL is passed, with just a =s40 suffix to it.
i.e
https://lh3.googleusercontent.com/a-/AOh1...%3Ds96-c
turns into
https://lh3.googleusercontent.com/a-/AOh1...%3Ds96-c=s40
which breaks the URL and presents a broken image...
was wondering if anyone encountered this?
and if i can save the user's google image as a profile image in the first place?

Related

Google Workspace Addon Google Analytics Tracking

I read the google help for tracking an addon (https://developers.google.com/gsuite/marketplace/use-analytics) and I am not sure, what to do on the google analytics side of the idea.
I added a stream and entered the url of the application url, which I can find in the sore entry settings of the google cloud plattform.
Then I entered the Stream ID in the configuration of my addon's store entry configuration page, where it asks for google Analytics-ID (I entered the G- ... number).
But I don't see any data in GA.
What did I get wrong in the first place? :)
Maybe I am on the wrong path, so I want to share my goal as well: I try to track three things of my google calendar add-on:
how often the add-on in the Marketplace is viewed
how often the add-on actually was installed
what the user did in the add-on, while using it.
thanks for your input and questions to lead me to the solution :)
Try to use a Universal Analytics Property, the one with ID like UA-XXXXX-Y. When you create a new property activate the advanced options and choose that property type.

How can I use Google's Vision API on images in my own website

I am very new to Google's API and machine learning in general. I want to use the Vision API labeling ability for a student project I am working on.
I would like to create a website that works similarly to the demo of the API on google's product page. I would like to be able to click on images in the website and see the labels that vision creates. If possible, I would like to use a pre-trained model like the advertising material. Additionally, if possible, I would like to be able to sort the images based on their labels in the website's interface. I attached an image of what the demo on the product page produces for reference (the image is a digital render that I created). I want to see how well the API can classify artificially created images.
I have looked through a lot of the documentation but I am not really sure where to start with all this. I also found this on github, but I am not sure how to utilize something like this for my own images. Can anyone give me some pointers?
You can send image bytes, a path to a file in GCS or a path to a public image: https://cloud.google.com/vision/docs/reference/rpc/google.cloud.vision.v1#image
It sounds like you are interested in sending the image bytes.

BIM 360 Field Forge - Retrieve Container ID

I am ultimately trying to build a custom integration with BIM360 Field to track and monitor field issues generated on a specific project.
Currently in the trial stage I am using Postman to make URI calls, mostly based on Sam Nseir's post Export BIM 360 Project Data via Autodesk Forge
I have everything from that post working correctly, Authentication, Projects list, and was able to extract my Hub Id with a https://developer.api.autodesk.com/project/v1/hubs call.
I am getting hung up trying to determine my Container ID based on this Forge Help Doc. I am only ever able to return a empty Data set "data":[] as shown in the output image below. I have tried adapting the filter logic from the help docs, but end up with the exact same result.
Output Image
I am using an Autodesk sample project, which I am the account admin of, so I don't believe permissions should be an issue. My custom integration has Account admin, and Document management access.

Easiest way to serve different content from the same link based of user agent

I am current using an Amazon EC2 server to perform a GET on a url that comes in, read the ID in the the url (?id=XXXXX) and display and image based on the ID.
I then read the user agent and if it's mobile display one image, if it's desktop display another image. This could also be split as android vs iphone, or other parameters.
My question is, is there another way other than a EC2 server to do this? Is it possible to do this with a CDN that can pick the appropriate file?
Can do with CloudFront, amazons CDN:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#request-custom-user-agent-header

me/feed with pic from different domain

I was trying to find this on facebook's site in their documentation but so far no luck. I'm sure others must have run into this before.
I use Amazon S3 for storing images. I didn't know ahead of time that if I named my bucket as my domain name with subdomain I could link that way, so until I move all of the pictures I have to link to mybucket.s3.amazonaws.com domain. When I include a picture from there with a post to the wall the picture doesn't show up. If I change the picture to one on the server itself the picture does show up. It seems that the domain name of the picture must match my app? I looked at bugzilla and didn't see this mentioned. Facebook's forum says to post questions here.
I'm using the C# Facebook SDK from CodePlex.
My code looks like (with error handling and authentication check removed):
var client = new FacebookClient(FACEBOOK_APP_ID, FACEBOOK_SECRET);
client.AccessToken = facebook.AccessToken;
var parameters = new Dictionary<string, object>();
parameters.Add("name", name);
parameters.Add("caption", title);
parameters.Add("message", message);
parameters.Add("link", link);
parameters.Add("source", link);
parameters.Add("picture", imageUrl);
client.Post("me/feed", parameters);
I verified that imageUrl does indeed have a correct picture, the domain name just doesn't match. The picture on amazon s3 has public read access. I can view it from my browser so I don't think it's a permission problem. I've tried a few different pictures with the same problem. Only time it's worked so far is when the picture was on the server itself.
So, my question is, is it a problem with me, or does facebook block images that don't match the domain name specified on the app?
You can upload the picture from that url, then add its object id in the post.
Refer to: http://developers.facebook.com/blog/post/526/?ref=nf
Uploading Photos to the Graph API via a URL
Earlier this year, we released support for uploading photos directly
via the Graph API. This requires sending the photo as a MIME-encoded
form field. We are now enhancing our photo upload capability by
introducing the ability to upload photos simply by providing a URL to
the image. This simplifies photo management for a number of use cases:
App developers who host their images on Amazon S3 or a similar
service can pass the S3 URL directly to Facebook without having to
download the file to their application servers only to upload it
again to Facebook. This improves performance and reduces costs for
developers.
Apps written on platforms that don't have good support for
multipart file uploads can create new photos more easily.
To upload a photo via a URL, simply issue an HTTP POST to
ALBUM_ID/photos with the url field set to the URL of the photo you
wish to upload. You need the publish_stream permission to perform this
operation. You can also include an optional message parameter to set a
caption for the photo.
I'am facing the same issue as well. Based on my observations it seems that facebook does not like it when the picture url has more than one sub-domain.
I tried the below 2 URL variations for the same image..
mybucket.s3.amazonaws.com - throws an error
s3.amazonaws.com/mybucket - works fine
:picture => 'http://mybucket.s3.amazonaws.com/footprints/15/coverimgs/medium.jpg'
OAuthException: (#100) picture URL is not properly formatted
:picture => 'http://s3.amazonaws.com/mybucket/footprints/15/coverimgs/medium.jpg'
{"id"=>"587472956_10150280873767957"}
Now i have to figure out how to change the URL structure for the image while passing it to the FB graph API.
I would log it as a bug. If this is really the case, which I kinda doubt, you could create a 301 redirect on your own domain for each image that redirects to the Amazon url.