I have some problems with Facebook sharing. Posted messages look normal via browsers (iOS, PC and Mac versions):
And only FB iOS app shows it wrong:
What could be the reason for this?
UPD:
I tried 200, 600 and 158 pixels images. Result:
My code is:
public LevelUPFeed (int reachedLevel, string pictureURL) //LevelUPFeed : IFeed
{
_linkDescription = string.Format("Just reached Level {0} ", reachedLevel);
_picture = pictureURL;
}
public void SendFeed (IFeed feed, Action<bool> callback)
{
//... callback creating
FB.Feed (
feed.ToId, feed.Link,
feed.LinkName, feed.LinkCaption,
feed.LinkDescription, feed.Picture,
feed.MediaSource, feed.ActionName,
feed.ActionLink, feed.Reference,
feed.Properties, convertedCallback);
}
feed = new LevelUPFeed (level, pictureUrl);
FBManager.SendFeed (feed, onFeedSent);
feed.LinkName is "Game Name", feed.Link "https://facebook.com", feed.LinkName is "Level Up!". All other strings is string.Empty
Picture links:
600px : http://i.imgur.com/10DdiWc.png
200px : http://i.imgur.com/0Smpm6s.png
There are image specifications in the Open Graph Sharing Best Practices documentation. Use PNG or JPG, 72 dpi, at 600 x 600 pixels for a feed image. The Feed Dialog documentation says 200 x 200, but the Games feed is specifically mentioned in the best practices document.
There are two different image sizes to use for game apps:
Open Graph Stories Images appear in a square format. Image ratios for
these apps should be 600 x 600 px. Non-open Graph Stories Images
appear in a rectangular format. You should use a 1.91:1 image ratio,
such as 600 x 314 px.
If this does not answer your question, could you post your API call code?
Related
Using Lightroom I know how to apply a camera profile (*.dcp file) to my *.DNG image.
I would like to do the same in an application which I'm writing, so I guess a good starting point would be to append this functionality to the dng_validate.exe application.
So I started to add:
#include "dng_camera_profile.h"
Then added:
static dng_string gDumpDCP;
And add the following to the error print:
"-dcp <file> Load camera profile from <file>.dcp\"\n"
Then I added the function to read the dcp from cli:
else if (option.Matches("dcp", true))
{
gDumpDCP.Clear();
if (index + 1 < argc)
{
gDumpDCP.Set(argv[++index]);
}
if (gDumpDCP.IsEmpty() || gDumpDCP.StartsWith("-"))
{
fprintf(stderr, "*** Missing file name after -dcp\n");
return 1;
}
if (!gDumpDCP.EndsWith(".dcp"))
{
gDumpDCP.Append(".dcp");
}
}
Then I load the profile from disk [line 421]:
if (gDumpTIF.NotEmpty ())
{
dng_camera_profile profile;
if (gDumpDCP.NotEmpty())
{
dng_file_stream inStream(gDumpDCP.Get());
profile.ParseExtended(inStream);
}
// Render final image.
.... rest of code as it was
So how do I now use the profile data to correct the render and write the corrected image?
You need to add the profile to your negative with negative->AddProfile(profile);.
My project raw2dng does this (and more) and is available in source if you want to see an example. The profile is added here.
So after playing around for a couple of days, I now found the solution. Actually the negative can have multiple camera profiles. So with negative->AddProfile(profile) you just add one. But this won't be used if it's not the first profile! So we first need to clean the profiles and than add one.
AutoPtr<dng_camera_profile> profile(new dng_camera_profile);
if (gDumpDCP.NotEmpty())
{
negative->ClearProfiles();
dng_file_stream inStream(gDumpDCP.Get());
profile->ParseExtended(inStream);
profile->SetWasReadFromDNG();
negative->AddProfile(profile);
printf("Profile count: \"%d\"\n", negative->ProfileCount()); // will be 1 now!
}
Next thing to get the image correctly is to have correct white balance. This can be done in camera or afterwards. For my application with 4 different cameras, the result was the best when using afterward white balance correction. So I found 4 (Temperature,Tint) pairs using Lightroom.
The question was how to add these values in the dng_validate.exe program. I did it like this:
#include "dng_temperature.h"
if (gTemp != NULL && gTint != NULL)
{
dng_temperature temperature(gTemp, gTint);
render.SetWhiteXY(temperature.Get_xy_coord());
}
The resulting images are slightly different from the Lightroom result, but close enough. Also the camera to camera differences are gone now! :)
Is it possible to write your own custom function in google sheets script that returns a drawn image, similar to how the SPARKLINE function works, except I want to make one that draws a pie chart instead.
I do not want to use Insert > Chart... > Pie Chart because that creates a floating chart on top of the spreadsheet. I would like to be able to write my own function that would return a pie chart that is embedded within the cell that the function is entered in, just like you can do with columns, bars, and line charts using sparkline.
How about following idea? This sample script embeds a chart to a cell using custom function on Spreadsheet. I think that this method is one of various ideas.
Problems :
When you want to create a chart and embed it to a cell using custom functions, you notice that insertChart() cannot be used. There are some limitations for using custom functions. But insertChart() creates floating charts. So in order to embed a chart to a cell, the function =IMAGE() is suitable for this situation. Here, setFormula() for setting =IMAGE() and DriveApp.createFile() for creating images from charts also cannot be used for custom functions.
Solution :
In order to avoid these limitations, I used Web Apps.
To use this sample script, please deploy Web Apps as follows.
On the Script Editor,
File
-> Manage Versions
-> Save New Version
Publish
-> Deploy as Web App
-> At Execute the app as, select "your account"
-> At Who has access to the app, select "Anyone, even anonymous"
-> Click "Deploy"
-> Copy "Current web app URL"
-> Click "OK"
When it deploys Web Apps, the approval required authorization can be done, simultaneously.
Sample Script :
Please copy and paste this script to a bound script of spreadsheet.
var folderId = "### Folder ID ###"; // This is a folder to save images.
var webappsurl = "https://script.google.com/macros/s/######/exec"; // Here, please put "Current web app URL".
function embedChart(range) {
var ac = SpreadsheetApp.getActiveSheet().getActiveCell();
var q1 = "?datarange=" + range;
var q2 = "&row=" + ac.getRow();
var q3 = "&col=" + ac.getColumn();
var url = webappsurl + q1 + q2 + q3;
UrlFetchApp.fetch(url);
}
function doGet(e) {
var sheet = SpreadsheetApp.getActiveSheet();
var chart = sheet.newChart()
.setChartType(Charts.ChartType.PIE)
.addRange(sheet.getRange(e.parameters.datarange))
.setOption('height', 280)
.setOption('width', 480)
.setOption('title', 'Sample chart')
.build();
var file = DriveApp.getFolderById(folderId).createFile(
chart.getAs('image/png').setName("chart_image.png")
);
file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
sheet.getRange(e.parameters.row, e.parameters.col).setFormula(
'=IMAGE("' + "http://drive.google.com/uc?id=" + file.getId() + '")'
);
}
Flow of Script :
embedChart()
Input =embedChart("a2:a6") in cell B7.
Using fetch(), sends data of a2:a6 and the inputted coordinate to doGet().
doGet()
Using doGet(), get the data.
Creates a chart using inputted range a2:a6. (in this case, creates a pie chart)
Saves a chart as an image. (in this case, saves as PNG)
Updates a permission of the image file to use for =IMAGE().
Embeds the image using =IMAGE() which was imported by setFormula().
Result :
By inputting =embedChart("a2:a6") in cell B7 as a custom function, following result can be obtained.
Note :
When the custom function embedChart() is used, loading time is about 40 seconds. (I don't know whether this occurs at only my environment.)
Permissions of the created image are ANYONE_WITH_LINK, VIEW.
embedChart() is overwritten by =IMAGE(). So when the spreadsheet is reopened, the response of =IMAGE() is much faster than that of embedChart().
If I misunderstand your question, I'm sorry.
When editing a vertex I would like to substitute the vertex symbol with SimpleMarkerSymbol and a TextSymbol but that appears to be impossible. Any suggestions on how I could do this? I want the appearance of dragging something like this (text + circle):
After taking some time to look at the API I've come to the conclusion it is impossible. Here is my workaround:
editor.on("vertex-move", args => {
let map = this.options.map;
let g = <Graphic>args.vertexinfo.graphic;
let startPoint = <Point>g.geometry;
let tx = args.transform;
let endPoint = map.toMap(map.toScreen(startPoint).offset(tx.dx, tx.dy));
// draw a 'cursor' as a hack to render text over the active vertex
if (!cursor) {
cursor = new Graphic(endPoint, new TextSymbol({text: "foo"}));
this.layer.add(cursor);
} else {
cursor.setGeometry(endPoint);
cursor.draw();
}
})
You could use a TextSymbol to create a point with font type having numbers inside the circle. Here is one place where you can find such font. http://www.fontspace.com/the-fontsite/combinumerals
Wont be exactly as shown in the image but close enough. Also some limitation it wont work with IE9 or lower (this is as per esri documentation, as I am using halo to get the white border).
Here is the working Jsbin : http://jsbin.com/hayirebiga/edit?html,output use point of multipoint
PS: I have converted the ttf to otf and then added the font as base64, which is optional. I did it as I could not add the ttf or otf to jsbin.
Well, Achieve this seems impossible so far however ArcGIS JS API provides a new Application/platform where you can generate single symbol online for your applications.
We can simply create all kind of symbols(Provide by ESRI) online and it gives you on the fly code which you just need to paste in your application.
This will help us to try different type of suitable symbols for the applications.
Application URL: https://developers.arcgis.com/javascript/3/samples/playground/index.html
Hoping this will help you :)
Hi have been working on this project for quite some time, and It has come to the point at which I need to get the channel banner of a user's channel. I have this url (https://i2.ytimg.com/i/zRJMLe36PT0Q2mhlmbU2OQ/1.jpg) that gets the channel avatar of the channel avatar via the channel id. (the id is the long string of text and numbers) I searched the internet for quite some time also, and was at no luck to finding the url. If anyone can find a url that works the same as the avatar, just for the channel banner, I would be greatly appreciated! Thanks, and cheers! (ps, I would rather not use php, but if there is a solution using php, I can use it)
You can get the banner image of a Youtube channel. Where the URL includes the word 'channel' followed by a 24 character string such as: https://www.youtube.com/channel/UCNa8NxMgSm7m4Ii9d4QGk1Q, then the following code will retrieve the banner information and more:
https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id={CHANNEL_ID}&key={GOOGLE_API_KEY}
Search for 'bannerImageUrl' to speed up the process if you are in a browser.
If you do not have a Google API key, visit the console and create one under the credentials menu. You should remove the curly brackets and not place the channel id or API key between them.
If you want to get the banner image of a YouTube channel with the word 'user' in the URL, such as: https://www.youtube.com/user/cocacola then I am not so sure. The solution on this page did not work for me.
I have just come across this result which shows more information.
Using Java with Jsoup to get the channels header image without using Youtube API:
public final static String YOUTUBE_HEADER_IMAGE_START_URL = "yt3.ggpht.com/";
public final static String YOUTUBE_HEADER_IMAGE_END_URL = "-no-nd-rj";
private void getYoutubeChannelHeaderImage(String channelUrl) throws IOException
{
Document document = Jsoup.connect(channelUrl).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1").get();
String html = document.toString();
Pattern pattern = Pattern.compile(YOUTUBE_HEADER_IMAGE_START_URL + "(.*?)" + YOUTUBE_HEADER_IMAGE_END_URL, Pattern.DOTALL);
Matcher matcher = pattern.matcher(html);
while (matcher.find()) {
String imgUrl = matcher.group(1);
if (imgUrl.length()<500)
System.out.println("https://" + YOUTUBE_HEADER_IMAGE_START_URL+imgUrl+YOUTUBE_HEADER_IMAGE_END_URL);
}
}
This code will output all available dimensions of a Youtube channel header image.
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1138-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj // 1138 x 188
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1707-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj // 1707 x 282
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w2120-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj // 2120 x 350
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w2276-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj // 2276 x 376
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj // 2560 x 423
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w320-fcrop64=1,00000000ffffffff-k-c0xffffffff-no-nd-rj // 320 x 180
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w854-fcrop64=1,00000000ffffffff-k-c0xffffffff-no-nd-rj // 854 x 480
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1280-fcrop64=1,00000000ffffffff-k-c0xffffffff-no-nd-rj // 1280 x 720
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1920-fcrop64=1,00000000ffffffff-k-c0xffffffff-no-nd-rj // 1920 x 1080
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w2120-fcrop64=1,00000000ffffffff-k-c0xffffffff-no-nd-rj // 2120 x 1192
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w320-fcrop64=1,32b75a57cd48a5a8-k-c0xffffffff-no-nd-rj // 320 x 52
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w640-fcrop64=1,32b75a57cd48a5a8-k-c0xffffffff-no-nd-rj // 640 x 105
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w960-fcrop64=1,32b75a57cd48a5a8-k-c0xffffffff-no-nd-rj // 960 x 158
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1280-fcrop64=1,32b75a57cd48a5a8-k-c0xffffffff-no-nd-rj // 1280 x 211
https://yt3.ggpht.com/2fCpG8MNmWvT8zz7MBFVlPMOA07bekDqK7FgNrdbh7ldLccLMsU1UwKlI1t3SJ5vxNJoA5pIYw=w1440-fcrop64=1,32b75a57cd48a5a8-k-c0xffffffff-no-nd-rj // 1440 x 238
i found a super quick way to do this. you can find the url in the console. i clicked on my avatar and then selected "my channel" from the nav. from there, click customize channel. now right click somewhere on the image. and then click inspect to open the console. you should now be targeting a div with an id of something like c4-header-bg-container. under the styles tab, there is a background-image attribute for that id. just copy the value inside the url() function. make sure you either remove the leading slashes or prepend https: to them. that is the url of your image. you may now do as thou wilt with it.
I'm trying to get last 5 tweets from a person. I did it, but profile picture is not looking normal, resolution is corrupted. like that. ! http://i.hizliresim.com/wLQEJZ.jpg
var $twitter = $('#twitter');
$.getJSON('http://www.demo.net/twitter.php?username=yeniceriozcan&count=5', function(data){
var total = data.length,
i = 0;
$twitter.html(''); // önce içindekini temizle sonra tweetleri yazdır.
for ( i; i < total; i++ ){
var tweet = data[i].text; // tweet
var date = parseTwitterDate(data[i].created_at); // tarih
var image = data[i].user.profile_image_url; // profil resmi
var url = 'https://twitter.com/' + data[i].user.screen_name +'/status/' + data[i].id_str;
$twitter.append('<div class="tweet"><a target="_blank" href="' + url + '"><img src="' + image + '" alt="" class="profile-image" />' + tweet + '</a> <span class="tweet-date">(' + date + ')</span></div>');
}
});
This is my code. I tried to that for to get profile picture,
var image = data[i].user.profile_image_url;
And also in other tweets file,
$tweets = $twitter->get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name='.$username.'&count='.$count);
print json_encode($tweets);
I used this api.
but I can not view pictures in normal resolutions. How can I fix it?
Thanks.
I found that using bigger still brought the picture back in a relatively small format. Using this answer enables you to resize the image allowing you to have a big image without distortion.
If you want to get the image full size just get rid of the "_normal" completely
http://pbs.twimg.com/profile_images/429221067630972918/ABLBUS9o_normal.jpeg
Goes to
http://pbs.twimg.com/profile_images/429221067630972918/ABLBUS9o.jpeg
Note: The urls in this answer are modified so as to not reflect my twitter details hence why entering them will give you a "no page exists"
When you read the url from data[i].user.profile_image_url, replace "_normal" with "_bigger". Here's the explanation from the Twitter docs:
User Profile Images and Banners
Update December 22nd 2020
This is still the case - works.
Update May 6th 2017
When you get the user's profile image via profile_image_url or profile_image_url_https (see User Profile Images and Banners), try to replace "_normal" at the end of the filename with "_400x400".
Seems that they are now scaling images down to 400x400 and then delete the original file.
In case you still need this questions answered (since none of the previous ones are marked as an accepted answer) this is how I managed to deal with the Twitter API image URL sizing:
Grabbing the URL from the API will return the "http" and "https" URL's in the following format(s):
http:
http://pbs.twimg.com/profile_images/378812345851234567/Ay2SHEYz_normal.png
https:
https://pbs.twimg.com/profile_images/378812345851234567/Ay2SHEYz_normal.png
For whatever reason Twitter decided that a 48x48 png was good enough.
If you want the full resolution you need to remove the "_normal" tag from either URL, as angryTurtle stated above. This will give you the URL of the full size image. Here is quick example work around of accomplishing this:
/// remove '_normal' from picture url to get full size
NSString *TWTRPicStringF = [twitterProfilePictureURLStringN stringByReplacingOccurrencesOfString:#"_normal" withString:#""];
Hopefully this helps you and you can mark one of these as the accepted answer to close the question!
FYI: I also have modified the URL contents to protect my own Twitter information, explaining the "no page exists" when using one of the provided URL's above.