Instagram API-返回的媒体被切断

Instagram API-返回的媒体被切断,instagram,instagram-api,endpoint,Instagram,Instagram Api,Endpoint,我已经搜索了所有地方,但没有一个链接解释或修复为什么会发生这种情况 每当我向Instagram发送图片端点请求时,所提供的大部分图片url都会被切断——与Instagram上的原始帖子相比,并不是整个图片都在那里。在我看来,也许在逻辑上,被切断的图像是一个人的,而不是完全正方形的 有没有什么方法可以得到完整的图像,而不需要裁剪以使其适合于一个精确的正方形 多谢各位 编辑:刚刚意识到开发者控制台中有一个非方形媒体选项,但是我检查了它,但它似乎不起作用。解决了。尽管这确实有效,但令人失望的Insta

我已经搜索了所有地方,但没有一个链接解释或修复为什么会发生这种情况

每当我向Instagram发送图片端点请求时,所提供的大部分图片url都会被切断——与Instagram上的原始帖子相比,并不是整个图片都在那里。在我看来,也许在逻辑上,被切断的图像是一个人的,而不是完全正方形的

有没有什么方法可以得到完整的图像,而不需要裁剪以使其适合于一个精确的正方形

多谢各位


编辑:刚刚意识到开发者控制台中有一个非方形媒体选项,但是我检查了它,但它似乎不起作用。

解决了。尽管这确实有效,但令人失望的Instagram的非方形媒体功能并没有达到预期的效果

$image_url = $insta_liked_array['data'][$image_key]['images']
['standard_resolution']['url'];

//parse url to get last segment before image name

$segments = explode('/', parse_url($image_url, PHP_URL_PATH));
$segment_removal = $segments[5];

//New Url without the segment
$image_url_dynamic = str_replace("/" . $segment_removal,"",$image_url);

echo $image_url_dynamic;
编辑: 有时,上面的代码可能不会像预期的那样执行,我经历了制作一些东西的麻烦,这些东西将…26行代码,所有这些都是因为instagram无法修复一个简单的复选框

//'/e35/c' is a common string in each url, so from this we can take 
//away the /c... section using this info
//whatever index [e35] is, check if the next index has c as the first 
//letter, if so, remove that part

echo "Exploding url, checking for non-square media...\n\n";
$segments = explode('/', parse_url($image_url, PHP_URL_PATH));

if(in_array('e35', $segments)){
//get the index of e35
$e35_index = array_search('e35', $segments);
//if the letter 'c' is in the next seg, remove it
// to check if 'c' is in the next segment
$c_segment = $segments[$e35_index + 1];

if (strpos($c_segment, 'c') !== false) {
echo "Non square media resolve in progress...\n\n";
//get rid of that section +backslash, (replace with nothing)
$image_url = str_replace("/" . $c_segment,"",$image_url);
echo "New url has been made...\n\n\n\n" . $image_url;
}
elseif(strpos($c_segment, 'c') === false){
echo "Square media detected, no need to remove a segment...\n\n";
$image_url = $image_url;
}
else {
echo "An error occured";
}
}
else{
echo "An error occured - url should contain 'e35' string";
}

解决了。尽管这确实有效,但令人失望的Instagram的非方形媒体功能并没有达到预期的效果

$image_url = $insta_liked_array['data'][$image_key]['images']
['standard_resolution']['url'];

//parse url to get last segment before image name

$segments = explode('/', parse_url($image_url, PHP_URL_PATH));
$segment_removal = $segments[5];

//New Url without the segment
$image_url_dynamic = str_replace("/" . $segment_removal,"",$image_url);

echo $image_url_dynamic;
编辑: 有时,上面的代码可能不会像预期的那样执行,我经历了制作一些东西的麻烦,这些东西将…26行代码,所有这些都是因为instagram无法修复一个简单的复选框

//'/e35/c' is a common string in each url, so from this we can take 
//away the /c... section using this info
//whatever index [e35] is, check if the next index has c as the first 
//letter, if so, remove that part

echo "Exploding url, checking for non-square media...\n\n";
$segments = explode('/', parse_url($image_url, PHP_URL_PATH));

if(in_array('e35', $segments)){
//get the index of e35
$e35_index = array_search('e35', $segments);
//if the letter 'c' is in the next seg, remove it
// to check if 'c' is in the next segment
$c_segment = $segments[$e35_index + 1];

if (strpos($c_segment, 'c') !== false) {
echo "Non square media resolve in progress...\n\n";
//get rid of that section +backslash, (replace with nothing)
$image_url = str_replace("/" . $c_segment,"",$image_url);
echo "New url has been made...\n\n\n\n" . $image_url;
}
elseif(strpos($c_segment, 'c') === false){
echo "Square media detected, no need to remove a segment...\n\n";
$image_url = $image_url;
}
else {
echo "An error occured";
}
}
else{
echo "An error occured - url should contain 'e35' string";
}

在API的客户端配置页面中有一个选项,可以将API设置为返回非方形介质,它位于迁移选项卡中:


在API的客户端配置页面中有一个选项,可以将API设置为返回非方形介质,它位于迁移选项卡中:


这是我已经指出的不起作用的地方——它仍然只返回croppud square media。我已经解决了这个问题now@LucaSarif确保在更改该设置后重新创建访问令牌;它不适用于已创建的令牌。已多次这样做,甚至从一开始就勾选了此选项创建了新客户端。我得出的结论是,我必须批准我的应用程序,这是永远不会发生的,或者它只是坏了@史蒂文·肖伯特这是我已经指出的不起作用的东西——它仍然只返回croppud square media。我已经解决了这个问题now@LucaSarif确保在更改该设置后重新创建访问令牌;它不适用于已创建的令牌。已多次这样做,甚至从一开始就勾选了此选项创建了新客户端。我得出的结论是,我必须批准我的应用程序,这是永远不会发生的,或者它只是坏了@史蒂文·肖伯特