I am using google charts to describe the datas. And I would like to show it in URL, which will be much easier to be added to a web page.
However, the official tutorial just tells me how to do it in HTML. So can I do it in URL (showing an image)? Thanks.
Related
I'm working with the Trello API. I want to attach an image to a newly created card. I have no problem POSTing the new card and getting the card id to then PUT the attachment.
My project is made in Laravel 5.4 and I'm using Guzzle to make the HTTP requests.
The image I want to attach is from the Google static maps API and I'm using an encoded polyline (which I generate using this script) to draw a figure over some area.
This is how the card should look like:
But it ends up looking like this:
If I go to Trello and attach the image (as an URL) manually everything works perfectly but when I do it through a HTTP request it looks like the second image above.
After doing some research I think the problem resides in the polyline string because it usually contains some characters that HTTP does not support. I've tried using PHP's urlencode() without any result.
I send the image URL as an URL encoded param since that is the only way the Trello API accepts it (even though the official Trello API docs say otherwise).
Do you guys have any other ideas | work-arounds | experience with this issue?
I think you can try to use Google URL Shortener or similar service to convert the complicated URL with encoded polyline to something really simple.
For example, I have the following static maps URL with polyline
https://maps.googleapis.com/maps/api/staticmap?size=512x512&scale=2&maptype=terrain&style=feature:all&path=weight:3%7Ccolor:0xff0000ff%7Cgeodesic:true%7Cenc:}sp}Gmrkl#m#wIiAaB_BaA}IcCmLoFqG_DuFkAyN[mEiBqN}MqFsLqUoxAyG{#qGqJwDkBeJMod#lScMzFcFvAwHn#wH[oGwAwI{EwFqGaHwKcS{e#mKkd#iGsi#wKem#iKg[aPg[_N_RiE{EoUaR{f#}X}d#sWo[mN}]_KqYcDePyCcQaGeUuM{PoO_SsWcLeTiSsi#{Ka[yRgb#sN{S}RaS_XkRiX{OiO{GgMiEoc#aDwq#{Eig#qHyhAeQ{n#Nqj#uOqp#qTcZmNyZkUcRkSsIiL{Qq[qHuPuLk]wIe]mLqd#sLm\kf#yAiRm^oXwe#uAazA}JgR{Qeb#yHsX}Gg\uDyViEwn#wHup#w#sCyT~AaKgo#qJmg#kGaT}Qud#cZch#y{#{gB_OeTaPkQkf#ae#kQcQ}MwPoQu[{GgPkJiZiEoRaIgh#_Gm[oQyj#kPk\iPkTi[cYuOyIqQsGcYuFm]gCug#g#cU{G}IaGeHcH}IsMyFaMsKi]eLw#qKab#kIwe#eDkLyKwRiGsFoOuGcGkAuQm#uH_#{W}DmOkFcJ}E_MkJ{WgTkLgL}I_KwJgGcHoBeGMaIjBuDhA_GRab#aEoKuCqFaEoIsQaG}NkDuL_#qR~BmNdR{b#zEaW~Cee#vEsv#vA}JfEeNpG_Q|A_HfAwOq#qQ{DeRgSou#eb#i|AyJc^aKcOeHyEm_#aNeOsFkDiCmEaGiIiV}e#__B}Kkc#{Q{fAg\wpBkLqrAeWuiDyUuwCqGak#aA_SFeNjCwWhI_WMaRjFgLbVueAdHa[fP}w#fAqT_BoVoHi}#{Hq{#yF}QyFaImH_FaQqGmQcJqH}IuWag#yFkQ{FyZcVcmAeJ_W{LcRqOaNgK{KeI{PeFoW}#eTp#qp#e#oRqHkr#gx#{|IwA_St#iSbAgNnGsXhRks#pNwk#bQsp#tVu|#zF}PhN}\rDoH~BaCvDqEn]el#fP_VrDiFbDaCdXoMbIgErCcDpCaFdCqIpFil#vFsq#ViQ}#qS{Bop#uCkaA{#o[\yVN{t#~W{zAdVowAZeNvA_MbEmTxHeZb#}IpCwQbIe#jMgp#tC_PvFkT~CgMdAaGeAGq#xDkAhEaBdHsBvIcESG|OsAlKaDlF{ErBgFg#}CoCaDcI{EcQ}F{FcHaDiNiGwGoDwGgEgOkEca#mQmVaLyFgEcIiOaG_QiDuLsBuCuJkIgWsT_m#uj#iPgNqSaEoKc#cBRgFpB_DdCqMjHyJxCsJv#aW_AcNsGuF}J&key=AIzaSyDztlrk_3CnzGHo7CFvLFqE_2bUKEq1JEU`
Now I apply the shortener service and get this URL: goo.gl/iytwvS
So, I can use the latter as src of the image as shown in the following example
http://jsbin.com/quridub/edit?html,output
I hope this helps!
I'm developing a website where the users can fill a textarea where besides various text, they can copy/paste a Google Maps link.
At the moment I'm able to recognize and catch those links, the next step would be to use them to show the corresponding map on another page.
The problem is that it seems that I can't use the link as generated by the Google Maps page, an example:
https://www.google.it/maps/place/Roma+RM/#41.9099856,12.3955722,11z/data=!3m1!4b1!4m5!3m4!1s0x132f6196f9928ebb:0xb90f770693656e38!8m2!3d41.9027835!4d12.4963655?hl=it&authuser=0, but also many other various formats depending on what the user was looking for (a specific place, directions...)
If I try to put this link into an iframe like
<iframe frameborder="0" src="<the_link_above>&zoom=17&key=MY_API_KEY"></iframe>
the map doesn't appear and looking into the browser's console I read Load denied by X-Frame-Options: <the above link> does not permit cross-origin framing.
A link which can be embedded has a different formatting, like https://www.google.it/maps/embed/v1/place?q=<an address>&zoom=17&key=MY_API_KEY
but I can't ask to the users to edit the link, they would just copy and paste what they get from Google as the website is not intended only for expert users, but for anyone.
Is there a method to use the link as generated by Google Maps or should I quit the idea to use it?
Looking to automate the tedious clicking to change the backround of my PNG images from white to transparent.
The images reside in Google Drive, and as new images are submitted I have to make it transparent, each time, again. There's got to be a better way!
I don't see any way to use that website with code. That website has what it calls an API, but it looks like it's nothing more than a link. You could use something like AutoIt, to reproduce the keystrokes that you manually do.
AutoIt website
If there was an online picture editor that had an API that would receive HTTP Requests, Apps Script can send and receive HTTP Requests.
Google Documentation urlFetch
But the online picture editor would also need to read your files from your Google Account.
HTML does have a canvas tag, that you can manipulate pictures with, but Apps Script currently doesn't work with the canvas HTML tag the last I knew.
You can access your Google Drive with Apps Script, and get files, but then you'd need to either send the file out somewhere, or process it yourself, just like that online picture editor does. If Caja would allow the HTML Canvas tag to work with HTML Service, there might be a way to automate what you want.
I created a way to re-size pictures with the Canvas tag, but it wouldn't work with Apps Script HTML Service.
I am POSTing an HTML page to the OneNote REST API, to:
https://www.onenote.com/api/v1.0/pages
I am doing this from Google App engine (Java), and it all works fine, except that I am having problems with the static Google maps that are linked within the HTML.
Specifically a static map WITHOUT an encoded path is working and showing up fine, e.g.:
http://maps.googleapis.com/maps/api/staticmap?key=<KEY>&sensor=false&
center=<LAT,LON>&scale=1&zoom=17&markers=<LAT,LON>&size=150x150
However, when I post including an encoded polyline, the images doesn't show up on the OneNote page that is created (it looks a broken link on the page), e.g.:
http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=150x150&
scale=1&path=enc:<PATH>&markers=<BLAH>&key=<KEY>
My first thought was that it wouldn't work because the google maps key can only be used from my own domain (although that wouldn't explain why the maps without encoded polylines worked already), so I added
https://www.onenote.com/*
to list of referrers. (I don't know that's the right referrer - just a guess based on the API URL). That didn't solve the problem.
Then I thought maybe it's because MS doesn't allow google maps on OneNote (or Google doesn't allow Google maps on OneNote). So I tried serving the google maps via my own website. That didn't work either. But what I could see from my server logs is that OneNote didn't even called the URL on my website of the maps with encoded polylines - which is weird!
The final idea I had is that maybe it's because the URL with encoded polyline is too long for the OneNote API to handle. So one thing I could try is to create short URLs to put in the HTML. Before I try that final step, thought I would ask for advice in case I am still headed the wrong way...
Thanks.
Edit: Here's an example of a URL that didn't work (excluding the key only):
http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=150x150&scale=1&
path=enc:obblHzpwnVY?QEmBqA#qEzDT|JeAtD{Qn#yQhD_CMeIZ}BeCO#A#A?H
&markers=label:S|49.331765,-123.169574|&markers=label:F|49.328255,-123.158863&
key=<KEY>
Note that the key is approx 40 characters long
This appears to have been a length of URL problem. I tried serving the maps from my own website with a very short URL...
http://MY_DOMAIN/mapwrapper/SHORT_KEY
....and they worked fine.
Google Adsnse has an API that you can use (if you qualify) to generate Adsense ads on your site. The core feature is the function generateAdCode that returns "an HTML snippet that can be dropped into an HTML page for the page to start receiving Google Ads."
Try as hard as I could, I couldn't find a basic example of what that returned "HTML snippet" will look like.
Can anyone please enlighten me?
(Of course, I can make some strong assumptions, but I rather see something more definite.)
FYI, I am simply trying to understand the intricacies of using Google Adsense from all the different angles.
Thanks!
What they mean by HTML snippet is actually a JavaScript snippet which in turn generates HTML. Just visit any page with Google Ads on it and check out the (rendered) source code to see what Google Adsense publishes on your site.