我可以在imgur发布之前调整图片大小吗?我已经测试了http://i.imgur.com/XXXXXl.png之类的链接,但我需要在
之前调整大小foreach ($_FILES['file']['tmp_name'] as $index => $tmpName) {
if( !empty( $tmpName ) && is_uploaded_file( $tmpName ) )
{
$file = base64_encode(file_get_contents($tmpName));
$pvars = array(
'image' => $file,
'type' => 'base64'
);
$timeout = 120;
$imgurClientID = "xxx";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.imgur.com/3/image');
curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Client-ID ' . $imgurClientID));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $pvars);
$response = curl_exec($curl);
curl_close($curl);
$dataImg = json_decode($response, true);
$link = $dataImg['data']['link'];
}
}
由于
答案 0 :(得分:0)
答案 1 :(得分:0)
您可以使用image magick调整大小