I use Instagram API and Fancybox Simplified to get an Instagram hashtag feed. Instructions there: http://www.blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified
This is PHP code to insert on a web page:
<?php
// Supply a user id and an access token
$userid = "MY_USER_ID";
$accessToken = "MY_ACCESS_TOKEN";
// Gets our data
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 18);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
// Pulls and parses data.
$result = fetchData("https://api.instagram.com/v1/tags/canon/media/recent?access_token=MY_ACCESS_TOKEN&count=18");
$result = json_decode($result);
?>
<?php foreach ($result->data as $post): ?>
<!-- Renders images. @Options (thumbnail,low_resoulution, high_resolution) -->
<a class="group" rel="group1" href="<?= $post->images->standard_resolution->url ?>"><img src="<?= $post->images->thumbnail->url ?>"></a>
<?php endforeach ?>
On the result web page I have undesirable insta photo with certain URL.
How I can remove this item from my grid feed?
Append some logic to delete images you don't want. I've used a simple comparison, which removes just one item, but you might apply a list instead:
// Pulls and parses data.
$result = fetchData("https://api.instagram.com/v1/tags/canon/media/recent?access_token=MY_ACCESS_TOKEN&count=18");
$result = json_decode($result);
// Delete images according to certain specifications
foreach ($result as $id => $post) {
if ($post->images->thumbnail->url == 'unwanted_image.jpg') {
unset($result[$id]);
}
}
(Posted on behalf of the OP).
Here is how I fixed it:
<?php foreach ($result->data as $post): ?>
<!-- Renders images. @Options (thumbnail,low_resoulution, high_resolution) -->
<?php if ($post->images->thumbnail->url == 'http://distilleryimage11.s3.amazonaws.com/accb25dcbd9c11e3a46812e95f55900b_5.jpg') {
continue;
}
?>
<a class="group" rel="group1" href="<?= $post->images->standard_resolution->url ?>"><img src="<?= $post->images->thumbnail->url ?>"></a>
<?php endforeach ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.