facebook event picture

Jun 26, 2009 at 9:42 AM

Code:

facebookevent fa = new facebookevent();
fa.pic = "http://somewhere/picture.jpg";
fa.pic_big ="http://somewhere/picture.jpg";
fa.pic_small ="http://somewhere/picture.jpg";


Problem:
When I call events.create() the event is published but the it's not showing the picture. The size of the picture is well below (99x31) the maximum size.

Question:

How do I post an event picture correctly with the event?

Thanks for the answer!

Jul 2, 2009 at 10:44 AM

Same problem here...

Any ideas?

Jul 2, 2009 at 11:20 AM

Hi

I am also struggling for same thing. I have gone through with source code as well. But could not find any solution. These parameters are not being used in Facebook.Event.Create() method.

Still waiting for any solution.

Developer
Jul 28, 2009 at 2:40 PM

Accoding to the docs on events.create(), the image actually has to be passed in as raw data. At the moment, this isn't directly supported in the toolkit, but you're free to try and implement it on your own. I'll go ahead and create a new work item for this so that we can keep track of it and hopefully implement it sometime in the future.

If you do end up implementing this on your own, please submit a patch for it (see Source Code tab at top of this page->Upload Patch). We'd really appreciate any contributions like that that help us fill in holes in the toolkit.

Developer
Jul 28, 2009 at 2:43 PM
Edited Jul 28, 2009 at 2:44 PM

Work item created: http://facebooktoolkit.codeplex.com/WorkItem/View.aspx?WorkItemId=13744

Vote for it if you'd like to see it implemented. The number of votes is part of what we use to decide which items to implement.

Jan 25, 2010 at 6:38 AM
koen_1983 wrote:

Code:

facebookevent fa = new facebookevent();
fa.pic = "http://somewhere/picture.jpg";
fa.pic_big ="http://somewhere/picture.jpg";
fa.pic_small ="http://somewhere/picture.jpg";


Problem:
When I call events.create() the event is published but the it's not showing the picture. The size of the picture is well below (99x31) the maximum size.

Question:

How do I post an event picture correctly with the event?

Thanks for the answer!

 Hi koen,

I have created facebook event but it is not publishing in my wall. Can u please post your code so that i can able to publish my event on my wall. I am using events.create() method for creating event.

I am not adding any image but still i am not able to publish my event. Please help me regarding this.

Thanks,

Ibrahim.

Mar 5, 2010 at 10:52 AM

I managed to add a quick and dirty overload for Create() that uploads the image. If I have time I'll clean it up and post the proper version as a patch. This one does not support async yet - as I say only a quick and dirty solution. I guess the proper solution should take the info from the event_info and based on that either call SendRequest<events_create_response>() or ExecuteApiImageUpload() like this version - and it should also support async.

 

public long Create(facebookevent event_info, FileSystemInfo data)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.events.create" } };

            var dict = new Dictionary<string, string>
            {
                {"name", event_info.name},
                {"category", event_info.event_type},
                {"subcategory", event_info.event_subtype},
                {"host", event_info.host},
                {"location", event_info.location},
                {"city", event_info.venue.city},
                {"end_time", event_info.end_time.ToString()},
                {"start_time", event_info.start_time.ToString()}
            };
            if (event_info.venue.street != null)
            {
                dict.Add("street", event_info.venue.street);
            }
            if (event_info.description != null)
            {
                dict.Add("description", event_info.description);
            }
            if (event_info.privacy != null)
            {
                dict.Add("privacy_type", event_info.privacy);
            }
            if (event_info.tagline != null)
            {
                dict.Add("tagline", event_info.tagline);
            }

            Utilities.AddJSONAssociativeArray(parameterList, "event_info", dict);

            _logger.InfoFormat("Uploading image '{0}' and creating event...", data.FullName);
            try
            {
                string uploadResponse = ExecuteApiImageUpload(data, parameterList);
                events_create_response response = Utilities.DeserializeXML<events_create_response>(uploadResponse);

                return response == null ? 0 : response.TypedValue;
            }
            catch (Exception e)
            {
                _logger.Error("Could not create event", e);
                return 0;
            }
        }

You can remove the _logger lines - I only added that for debugging purposes.

Hope this helps somebody

Miklos