I have seen many posts through which we can upload image on S3, but what if we want to save image from google/facebook , that is something like graph.facebook.com/abc.img (suppose it is a valid image)
I have seen a similar post but that uses Node.js but I simply want to use php to save image on s3,
any help in this matter is appreciated Thanks
You could use this Facebook SDK PHP Class:
https://developers.facebook.com/docs/reference/php/4.0.0
And this one for S3:
https://github.com/tpyo/amazon-s3-php-class
Get the image from Facebook with the Graph API.
Upload it to S3 with the Amazon S3 PHP Class
Should be pretty easy ;)
Related
I use TwitterOauth, a Abraham Williams library for Twitter API.
I want upload a media to insert into Direct Message.
I've an error when I try to upload base64 encode PNG image, with chunked, or not.
$upload = $connection->upload('media/upload', [
'media_data' => $base64Encoded,
'media_type' => 'image/png',
], true); // chunked
dd($upload);
Some people talk about passing media_data to media and giving the path to the file, but the Twitter API allows to give base64 encoded media, so I'm trying to make it work because I don't want to transfer the media to the server before uploading it to Twitter, even temporarily, because I don't have write access to the server.
So I generate a base64 image, and I just want to upload it to Twitter via the API and TwitterOauth SDK.
The image is generated with PHP, I encode it in base64. I want to upload directly to the Twitter API without saving the image. Twitter API allows this with the media_data parameter, but I can't figure out how to use it.
Here, the error I have when I execute the script.
How I can upload media from Twitter API?
According to https://github.com/abraham/twitteroauth/issues/681, that problem is worked on since some years, but without any progress. If the library does not support reading from a raw string yet, you should either write your raw string to a file (because reading data from a file to upload that data is supported), or you could work on that ticket to get it done within the library.
That's the beauty of open source: if a library does not support your needs, you can extend it and make others happy that might have the same problem :)
We have a CMS on YouTube. I am trying to write a PHP script using Youtube API that uploads sound recordings and creates assets based on these recordings.
I am reading the references on inserting assets in Google developers:
https://developers.google.com/youtube/partner/docs/v1/assets/insert
The example shown here is about uploading videos.
The following snippet shows how to create a video insert request.
// Create a request for the API's videos.insert method to create and upload the video.
$insertRequest = $youtube->videos->insert("status,snippet", $video,
array('onBehalfOfContentOwner' => $contentOwnerId,
'onBehalfOfContentOwnerChannel' => $channelId));
But i am not finding anything regarding creating an audio or sound recording insert request to be able to upload the recordings. So how to create insert sound recording insert requests instead of video?
Appreciate any help regarding this issue. Thank you
I think you are confused between assets and claims. In that example, you insert video for claim not for asset.
What you are asking is uploading a reference audio. Here's the full guide: https://developers.google.com/youtube/partner/asset_reference_upload_example
I am developing the server side php code of a mobile application using PHP with code igniter. As of now, I would like to allow users to upload images to Amazon S3 to and further allow the user to retrieve the Amazon Cloud Front url of the image that they uploaded. However, I am stuck on the image uploading part of the code. I currently get post input parameters the following way:
$userName = $this->input->post('userName');
if (!empty($userName))
{
...
}
When I search on google, all I find are scripts on how to upload images from multipart forms for example, or forms in general: Like in this link, for example
We do not use any form at this point in our app. Is there any other way to do so in php+codeigniter? Is there a similar CI way to get images from post?
EDIT: We are also thinking of uploading the images directly from our application to Amazon S3 and then storing the amazon s3 url in our database, which would also reduce traffic to our server.
Any thoughts?
Check out CodeIgniter's file upload class.
How to upload an audio file in facebook using graph api in php? use
feed or anything i can't figure out how to upload?
As far as I know this is not possible. You can only upload photos and videos. But you could host your audio objects on your site and share them via the Opengraph Audio ComplexType. See the reference here: https://developers.facebook.com/docs/opengraph/creating-custom-stories#propertytypes
I am developing a website, where I am allowing users to upload videos, but if the members numbers keep on increasing and they keep on uploading more videos it will be expensive for me. So I want to upload the movies to youtube instead, is this possible?
By viewing some other posts here, I am thinking it is possible?
You need Youtube API to upload the videos with PHP.
There are some ready scripts you can use to upload to youtube, the one that deserves mention here is:
PHPTube
More Resources
Use the YouTube API with PHP
YouTube Uploader
In addition to Sarfraz's links you also have the Services_YouTube PEAR package and the Zend_Gdata_YouTube class. They are both very well documented.