如何从PHP中裁剪的Instagram中获取图像?
我使用curl从Instagram中获取图像,直到2个月前,默认情况下标准分辨率标签才被裁剪,但是,现在它们以原始大小显示。我怎样才能再次裁剪图像?这是我的密码如何从PHP中裁剪的Instagram中获取图像?,php,curl,instagram,instagram-api,Php,Curl,Instagram,Instagram Api,我使用curl从Instagram中获取图像,直到2个月前,默认情况下标准分辨率标签才被裁剪,但是,现在它们以原始大小显示。我怎样才能再次裁剪图像?这是我的密码 <?php function gallery() { $user_id = ; $client_id = ""; $token = ""; $url = "https://api.instagram.com/v1/users/".$user_id."/med
<?php
function gallery() {
$user_id = ;
$client_id = "";
$token = "";
$url = "https://api.instagram.com/v1/users/".$user_id."/media/recent/?access_token=".$token;
function fetchData($link) {
$ch = curl_init(); //initalise curl session
curl_setopt($ch, CURLOPT_URL, $link); //url to process (can be fed directly into init parameter)
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //does not check the existence of a common name in the SSL peer certificate (optional)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //stop cURL from verifying the peer's certificate
curl_setopt($ch, CURLOPT_POST, 0); //do a regular HTTP POST if set to 1
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); //info type
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //set to true stops it returning json as string
$output = curl_exec($ch); //executes curl session
curl_close($ch); //close curl session
return $output;
}
$result = json_decode(fetchData($url)); //Decodes a JSON string
$posts = $result->data;
foreach($posts as $post){ ?>
<li class="gallery__item">
<a target="_blank" href="<?=$post->images->standard_resolution->url; ?>">
<img class="gallery__img" src="<?=$post->images->standard_resolution->url; ?>">
</a>
</li>
<?php }
}
?>
我对instagram api不是很熟悉,但也许类似的东西可以帮助您。虽然这可能远远不是你需要的,以防你找不到另一个解决方案,但你仍然有这个谢谢你,我会看看能不能用它