Reputation: 335
I want to post images and videos on google+ through my titanium application. Here is my url which I am using:
var webView = Ti.UI.createWebView({
url: 'https://plus.google.com/share?client_id=1234567889.apps.googleusercontent.com&continue='+Ti.App.id+'%3A%2F%2Fshare%2F&text='+textToShare+'&url='+urlToShare+'&bundle_id='+Ti.App.id+'&gpsdk=1.0.0'
});
win.add(webView);
Can anyone tell, How to pass image as parameter in above url?
Any help would be appreciated.
Thanks
Upvotes: 0
Views: 294
Reputation: 725
You can add/upload image on Google+: Reference Link: https://developers.google.com/+/domains/posts/creating
// Helper function courtesy of https://github.com/guzzle/guzzle/blob/3a0787217e6c0246b457e637ddd33332efea1d2a/src/Guzzle/Http/Message/PostFile.php#L90
function getCurlValue($filename, $contentType, $postname) {
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
// See: https://wiki.php.net/rfc/curl-file-upload
if (function_exists('curl_file_create')) {
return curl_file_create($filename, $contentType, $postname);
}
// Use the old style if using an older version of PHP
$value = "@{$filename};filename=" . $postname;
if ($contentType) {
$value .= ';type=' . $contentType;
}
return $value; } $filename = '/path/to/file.jpg'; $cfile = getCurlValue($filename,'image/jpeg','cattle-01.jpg'); //NOTE: The top level key in the array is important, as some apis will insist that it is 'file'. $data = array('file' => $cfile); $ch = curl_init(); $options = array(CURLOPT_URL => 'http://your/server/api/upload',
CURLOPT_RETURNTRANSFER => true,
CURLINFO_HEADER_OUT => true, //Request header
CURLOPT_HEADER => true, //Return header
CURLOPT_SSL_VERIFYPEER => false, //Don't veryify server certificate
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data
);
Upvotes: 0
Reputation: 6851
Sharing of images is not available through the URL, buttons, or SDKs at this time.
In fact for sharing URLs, you'll notice in the Google+ stream's share box that you can't do both a link preview as well as an image upload, its one or the other, which is probably the basis for why the sharing options such as the one you're looking for don't offer this ability.
Upvotes: 1