Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8712017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:01:15+00:00 2026-06-13T05:01:15+00:00

I am using the C# FaceBook API to post a status update and an

  • 0

I am using the C# FaceBook API to post a status update and an image to a wall. I am using the following code:

    public string PostToFaceBookPage(string appKey, string appSecret, string wallId, string postMessage, string imageUrl)
    {
        string id = "";
        if (string.IsNullOrEmpty(imageUrl))
            imageUrl = "";
        var client = new Facebook.FacebookClient();

        dynamic result = client.Post("oauth/access_token",
                                      new
                                      {
                                          client_id = appKey,
                                          client_secret = appSecret,
                                          grant_type = "client_credentials",
                                          redirect_uri = "anywhere",
                                          scope = "publish_stream"
                                      });
        client.AccessToken = (result)["access_token"];

        if (!IsId(wallId))
        {
            result = client.Get(wallId);
            id = result["id"];
        } else
        {
            id = wallId;
        }

        if (imageUrl == "")
        {
            result = client.Post("/" + id + "/feed", new
                {
                    message = postMessage,
                    scope = "publish_stream",
                    privacy = "{\"value\": \"EVERYONE\"}"
                });
        } else
        {
            var uri = new Uri(imageUrl);
            string imageName = Path.GetFileName(uri.LocalPath);
            string mimeType = GetMimeType(Path.GetExtension(uri.LocalPath));
            var media = new Facebook.FacebookMediaObject
                {
                    FileName = imageName,
                    ContentType = mimeType
                };

            media.SetValue(GetImage(imageUrl));
            result = client.Post("/" + id + "/feed", new
            {
                message = postMessage,
                source = media,
                picture = imageUrl,
                scope = "publish_stream",
                privacy = "{\"value\": \"EVERYONE\"}"
            });
        }

        return "";
    }

Everything is working just fine. My only problem is that my images are all posting the same exact size, regardless of the size of the actual image. Is there a way to tell FaceBook the size of the image so it doesn’t just post small thumbnails of the image?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:01:16+00:00Added an answer on June 13, 2026 at 5:01 am

    I’m not sure if Facebook API can have these parameters as it has been a few years since I have worked with the API.

    As a temporary fix however, you could try resizing the photo before uploading it to facebook.

    You can use the below code from http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing

    private static Image resizeImage(Image imgToResize, Size size)
    {
       int sourceWidth = imgToResize.Width;
       int sourceHeight = imgToResize.Height;
    
       float nPercent = 0;
       float nPercentW = 0;
       float nPercentH = 0;
    
       nPercentW = ((float)size.Width / (float)sourceWidth);
       nPercentH = ((float)size.Height / (float)sourceHeight);
    
       if (nPercentH < nPercentW)
          nPercent = nPercentH;
       else
          nPercent = nPercentW;
    
       int destWidth = (int)(sourceWidth * nPercent);
       int destHeight = (int)(sourceHeight * nPercent);
    
       Bitmap b = new Bitmap(destWidth, destHeight);
       Graphics g = Graphics.FromImage((Image)b);
       g.InterpolationMode = InterpolationMode.HighQualityBicubic;
    
       g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
       g.Dispose();
    
       return (Image)b;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to post a status update using facebook php sdk. Code posted below. As
I'm trying to post a Facebook status update, using the Facebook iOS API, with
I want make a wall post on friend wall using facebook graph api. Everything
I am using the following PHP code to post to my page wall. it
I try to post facebook status to a page using facebook api. i get
I'm trying to do the following using FB's official PHP SDK: $facebook->api( '/me/feed', 'POST',
I'm able to update the status on my PROFILE wall using this code: require_once
I want to share a link using Facebook Graph API. I am doing following.
I am trying to post to a user wall using the Graph API. I
I know how to post an image using the GRAPH API and I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.