Setting Thumbnails for Google Classroom Coursework - google-api-client

We've been trying to get the custom coursework thumbnail working and have been unsuccessful so far. We've tried both a page URL and a url directly to a thumbnail image. We're using the PHP client like so:
...
$materialLink = new Google_Service_Classroom_Link();
$materialLink->setUrl("https://www.oursite.net");
$materialLink->setThumbnailUrl("https://i.ytimg.com/vi/m9We2XsVZfc/hqdefault.jpg");
$materials = new Google_Service_Classroom_Material();
$materials->setLink($materialLink);
...
However, instead of the custom thumbnail showing, the default (a snapshot of our crawled site) always shows as the the coursework thumbnail.
Has anyone successfully used the custom thumbnail feature?

It's read-only. (thanks Mr.Rebot). The documentation notes that but it didn't resonate because you can set the thumbnail URL utilizing the methods, which seems a bit odd.

Related

Wrong image on facebook catalog

I have developed a daily csv file with php and mysql technology. Facebook uses this csv to show all our products on our facebook store.
The problem is that facebook displays a wrong image for some products. I have checked my csv and the image is right.
After that, I accessed to facebook catalog administration over a wrong image, then I saw that the product is showing the right image on the administration page.
Example:
Wrong image: https://www.facebook.com/products/image/?item_id=2344243688984642&display=multi&version=1&image_id=2169702346485626&image_width=186&image_height=186&display_option=background_padding&logging_boundary=item_preview
The right image that appears on 'edit product': https://external.xx.fbcdn.net/safe_image.php?d=AQCLCxZ9xrRUhd9m&url=https%3A%2F%2Fshop.atosa.es%2Fimg%2Fp%2F1%2F0%2F1%2F1%2F1011.jpg&_nc_hash=AQDWNd_Ct7njTn3V
It seems the wrong image is hosted by facebook and the right image by our server
I think that FB has a cache or something similar that do not update the image.
Any idea to update that wrong images?
I believe once before when you've been creating your catalog you still served a wrong image to FB. When FB fetches you feed now it sees the same URL and doesn't update the image because of that.
The solution would be to add any arbitrary parameter at the end of you image link like.
https://youserver/image.jpg?id=1
It should still return your image, but be a new link so that FB could recognize smth has change. It helped in many cases I had with wrong images in catalogs.
The ultimate solution would be to change the product's ID in the feed which will lead to FB creating an absolutely new product in the catalog. Mind, that it will discard product stats and you'll have to send that new ID in pixel or you mobile app.
Try the link solution first. You can also duplicate the product just adding a test one to the feed and check if a new fake test product looks correctly.
Let me know if it helps.

After uploading an image to google cloud, how can I get a link to that image?

After uploading an image, I get back metadata that has a mediaDownloadLink that will download the file when accessed. Is there a way to get a link that will display the image in the browser without downloading it?
In general, any object you set to be publicly accessible (which presumably you wanted to do to use it to host images on a website), you can then access with https://storage.googleapis.com/<bucket>/<object>. You can see this link also if you go to the cloud console and make an object publicly viewable and look for the Public link you can click.
If you have problems with the link downloading instead of displaying by itself in a browser, you may need to make sure the content-type header is set correctly; for example if using ByteArrayContent to upload data using the Java API, you'll want to set a string like "image/jpeg" in its constructor for "type".

Changing metadata for Ember.js apps

I have problems with linking my website (built with Ember.js) to Facebook (for each page - there's the same title, description, image etc - of course). I'm wondering if there is any solution to fight with this, without bringing that metadata (for each page) directly from the backend? I would like to change title, description, image etc for each page.
You can actually change title, description and other meta tags (by extending routes in Ember.js), but this is done only on client side and won't actually change the data so that Facebook for example can read the data and get the proper results.
Also, I cannot just put meta tags in since that it's not valid.
So, is there any other solution to properly use "open graph" metadata inside Ember.js app?
Concrete example:
http://www.skripinc.com/ -> this is the page about which I'm talking about. When I try to share it on Facebook, it will always pull the same Title, Description and image, which is set under metadata inside . I want to be able to have different metadata for each page, without bringing the data from the backend (with PHP or whatever).

Loading FB logo from FB's own CDN

Is there a url we can src for the FB logo that will be the same src as what gets generated after FB.init completes?
I doubt that I can hard-code the FB CDN link below and expect it to work for all users and also stay up-to-date.
https://s-static.ak.fbcdn.net/rsrc.php/v1/yL/r/FGFbc80dUKj.png
I basically want to reduce another image request for a FB logo sprite that already gets loaded with any other social plugin I have on my site.
Try using font-awesome's icons.
fa-facebook-official: Font Awesome Icons
and apply facebook logo's official color in css ( #3B5999 ).
Given that the URL still (after 5 months) resolves to the image correctly, I would say that you are probably OK using the link you have.
As a fall-back, though, you may want to consider hitting the link with an ajax call and changing your usage of that URL to a locally cached copy just incase the link ever goes dead. It's slightly more work, but it's a functional way to use a 3rd party's image and still fall back to your own version if theirs goes away.

How does facebook's Share a link feature work?

I'm trying to implement a feature like that where a user inputs a url and when displaying that url I want to have a custom display (an embed object if it's a video from youtube, a thumbnail if it's an image link, title and excerpt of body if it's a normal link).
How can such a feature be realized?
There is a new idea called oEmbed that a few sites support (Flickr, Vimeo and a few others) that addresses this problem. oEmbed site
Otherwise, just check the site against a list of ones you pick and then pull out the relevant bits to construct an embed link.
I liked the idea of oEmbed a lot but unfortunately it doesn't has that much adoption yet.
oohEmbed tries to solve this issue by building oEmbed for many websites.
For the feature to work, it needs the server's interaction where I believe the following scenario is how it works
Assume that we have the site humanzz.com and that it provides such feature
A user enters a url on the humanzz.com's webpage and presses a button like facebooks' preview button
An AJAX call is made to a dedicated page on humanzz.com
humanzz.com does calls the remote website and gets its data
The AJAX call now returns the page's data (oEmbed JSON object)
This involves so much server's overhead.
I really wanted to do it using JavaScript as the server's role was only to bypass "Same Origin Policy"'s restrictions.
oohEmbed allows bypassing the server's step by specifying a callback parameter to oohEmbed so that the JSON object returned is passed to a callback function on your page.
An example illustrating this is as follows
Add a script tag dynamically to your page
< script type="text/javascript" src="http://oohembed.com/oohembed/?url=http%3A//www.amazon.com/Myths-Innovation-Scott-Berkun/dp/0596527055/&callback=myCallBack">< /script>
This would result in executing myCallback(oEmbedJSONObject) which is great.
The problem with that solution is you still have to have a fallback for websites that don't have oEmbed representations.
For the embedded things, I have been using auto_html ( https://github.com/dejan/auto_html) with great success (vimeo, youtube, images) and even added soundcloud myself. But I am still looking for a "thumbnail" generation with an image and text facebook-like.
I guess you have to construct it by yourself by manually parsing the kind of URL you get.
If it is an image url, well then you just have to rescale it and in case the user clicks on it, then handle that by opening the original one somehow.
If it is a link to some youtube video, then you have to take a look at how the embedding of Youtube videos works. You can just copy the code that is provided by Youtube itself, and then exchange the parts with the URL to the video with the URL you got from your user.
I did never implement something like that, but I assume it should work somehow like this.