Closed dashawk closed 10 years ago
Well I've never used Facebook's API, but it doesn't seem like it would be too tough. This is just off the top of my head, but here's how I'd guess you go about it:
Here's a very simple example of how your server-side script for retrieving photos may look:
<?php
if (!isset($_REQUEST['img_url'])) {
exit;
}
// Retrieve the image
$response = file_get_contents($_REQUEST['img_url']);
if ($response === false) {
exit(json_encode(array('success' => false)));
}
// Save it somewhere
$save = file_put_contents('/savePath', $response);
if ($save === false) {
exit(json_encode(array('success' => false)));
}
echo json_encode(array('success' => true));
This code hasn't been tested and probably doesn't work, and you probably need to add some checks to make sure malicious URLs aren't being sent and whatnot, but that's generally how I think I'd do it.
Hope this helps, let me know how it goes!
ETA: I'm gonna go ahead and close this issue since it isn't directly about the plugin, but I'm still interested in hearing about what you figure out.
Hello again,
Can we upload images or files from a given URL?
I am trying to upload photos from my facebook albums. I have a modal window from bootstrap containing my facebook albums, when I click an album, my photos will show up. What I want is that, when I click on a photo, it should upload that photo in my photos folder.
Maybe you could help me on this one.
Thanks