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!
Related
I have some data along with images in a Google Sheet.
I am sending the data as a JSON response and I have deployed the script as a web app.
I am using the code:
SpreadsheetApp.openByID("<sheet_id>").getSheets[0].getDataRange().getValues()
I am able to load the data properly but I am not able to load the images.
For the cells with image, I get Empty String.
Can you please suggest a way to load images using the same script?
If it can provide a URL to my image saved in the sheet, then also it will solve my problem as I just wan't to display the image.
At the moment, you can obtain the image URL but under very special conditions:
The image has to be defined as an "Over cell" image (it cannot be an "In-cell image", as they are not supported by Apps Script).
The images have to be inserted by URL (not by uploading it from your local system).
The way to do it would be to:
Obtain the Sheet you want the images of.
Obtain its images using the getImages() method.
Obtain the URL of each image by using the getUrl() method.
If you are interested in the possibility of obtaining "in-cell" images more easily, I suggest you visit the feature requests in the Google's Public Issue Tracker or consider creating a brand new one.
I am creating a personal app and I am having some trouble. I have tried using the Instagram API to get a JSON feed of images by hashtag (any image insta, not just images on my profile).
My issue with the API is that i cannot seem to search public images without having my app in live mode. i keep getting a 400 unauthorized access_token error, even though i do have a valid access token.
I cannot put my app in live mode because insta require a privacy policy url and a company name and I am not a company. I am an independent dev making a personal app.
Whilst searching through stack overflow i cam across this url:
https://www.instagram.com/bikerpicgirl/media/
This allows me to get images by user without the API. I am wondering if anyone knows a similar url where i can get a feed like this but for hashtags instead of users.
I could just make a scraper that mimics the search process but this seems way to overkill and is alot of effort for something that should be so simple.
Yes, you can explore Instagram media by hashtags with this url format:
/explore/tags/your-tag/
for example if hashtag is #amsterdam your url would look something like this:
https://www.instagram.com/explore/tags/amsterdam/
As Jon Goodwin mentioned in the comment this example link is subject to change and may not work in the future.
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.
I'm trying to create a map of customer locations using Google maps.
It would be very convenient to display customer information in the balloons that pop up when you click a marker. However, some of that data should not be public, and the company would rather not disclose it to Google either.
I have access to (and can set up a server if need be) that runs something server side to generate .kml, Javascript, or serve a web page (including the js in that).
I've thought of a few ways to go about this. First is embedding html in .kml and having the contents of the balloon replaced by JavaScript making an asynchronous request to a private url/server. Unfortunately, it looks like JavaScript is stripped out if you are loading a .kml file by just putting the URL of the .kml file in the search box of google maps. I also found that it seems that iframes are also stripped out. One thing I do not know is if I set up a xhtml page that uses the Google maps API if that would let me load data from a private server directly to the browser without that data being loaded through Google.
One option that appears it will work is just putting a link in the .kml html for the balloon and having that link go somewhere. But that makes a whole extra step to see what the marker is, and diminishes the value of the whole thing in the first place.
So, is there a way to do what I'm attempting to do (load private data into the placemark bubbles directly to the user's browser instead of through Google)? If so, which option is the most maintainable/clean?
With Google's map API, you can write an (x)html page that loads a google map using javascript.
You can then have that javascript load data from a server directly to the browser (in something like JSON or XML) where the javascript can parse it and then add each point to the map. That way, the data does not route through Google's servers.
I'm able to post a status on the users wall using GRAPH API - https://graph.facebook.com/me/feed/. But I have problem with the image associated with the post.
In my case, the picture URL looks like this : https://images.XXXXXX.com/Images.aspx?imageId=??? , retrieves image based on request parameter . If I mention the URL as above I don't see the images displayed . Whereas if I mention the picture URL as a static URL (i.e. https://digitalpictures/test.gif), it works . Please help me to resolve this problem
You could save the image from the picture URL as a file with a static URL, then delete it once it's been uploaded to Facebook.
Make sure the https://images.XXXXXX.com/Images.aspx?imageId=??? can be seen by the facebook linter tool. Use it as an og:image tag on a public url. If facebook can't lint it, you can use it as the Picture URL in your graph API call.
Add Open Graph tags to the GRAPH API request, specifically "og:image", "https://images.XXXXXX.com/Images.aspx?imageId=??" for your image.
Facebook Open Graph Protocol 1