我不确定线路通知是否支持从本地发送图片。
但我尝试阅读该文件并尝试了很多图片。
我还是不能 如何向我发送照片文件?
我尝试参数imageFile
但不起作用。
/*-------------line noti----------------------*/
$line_api = 'https://notify-api.line.me/api/notify';
$access_token = 'token_code';
$message = 'test'; //text max 1,000 charecter
$image_thumbnail_url = 'https://dummyimage.com/1024x1024/f598f5/fff.jpg'; // max size 240x240px JPEG
$image_fullsize_url = 'https://dummyimage.com/1024x1024/844334/fff.jpg'; //max size 1024x1024px JPEG
$imageFile = 'copy/240.jpg';
$sticker_package_id = ''; // Package ID sticker
$sticker_id = ''; // ID sticker
$message_data = array(
'imageThumbnail' => $image_thumbnail_url,
'imageFullsize' => $image_fullsize_url,
'message' => $message,
'imageFile' => $imageFile,
'stickerPackageId' => $sticker_package_id,
'stickerId' => $sticker_id
);
$result = send_notify_message($line_api, $access_token, $message_data);
echo '<pre>';
print_r($result);
echo '</pre>';
}
/*-------------line noti----------------------*/
function send_notify_message($line_api, $access_token, $message_data){
$headers = array('Method: POST', 'Content-type: multipart/form-data', 'Authorization: Bearer '.$access_token );
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $line_api);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $message_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
// Check Error
if(curl_error($ch))
{
$return_array = array( 'status' => '000: send fail', 'message' => curl_error($ch) );
}
else
{
$return_array = json_decode($result, true);
}
curl_close($ch);
return $return_array;
}
否imageFile
:
如何将图像本地发送到行通知?
答案 0 :(得分:0)
plot(x,y,xlim=range(x), ylim=range(y), xlab="x", ylab="y", main="Filled Plane",pch=16)
#lines(x,y,xlim=range(x),ylim=(y),pch=16)
for(i in 1:20){
arrows(x[i],y[i],x[i+1],y[i+1],length = 0.25, angle = 30, col = 1:3)
}
答案 1 :(得分:0)
$file_name_with_full_path = 'D:\\xampp\htdocs\linenotify\images\flower.jpg';
$imageFile = curl_file_create($file_name_with_full_path);
答案 2 :(得分:-1)
$imageFile = '@C:\copy\240.jpg';