Hi Phương nói rõ ra đi An tạo ^^
giống imgur đấy
Hi Phương nói rõ ra đi An tạo ^^
giống imgur đấy
giống imgur đấy
Cái imgur api key đó bị xóa rồi hix
viết 1 cái khác giống như thế ý
à hì, để an tìm lại.. có cái api up lên medifire
viết 1 cái khác giống như thế ý
<span onclick="document.querySelector('#input_frm').click()" id="up_info">Tải ảnh lên</span><input style="visibility: collapse; width: 0px;display:none" type="file" onchange="upload(this.files[0])" id="input_frm"/>
<img id="hinh"></img>
<script type="text/javascript">
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
document.querySelector("#up_info").innerHTML='Đang tải lên';
var fd = new FormData();
fd.append("image", file);
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://uploads.im/api?upload");
xhr.onload = function() {
document.querySelector("#up_info").innerHTML='Đã tải lên ^ok^';
var link = JSON.parse(xhr.responseText);
document.querySelector("#hinh").src=link.data.thumb_url;
console.log(link);
}
xhr.send(fd);
}
</script>
<span onclick="document.querySelector('#input_frm').click()" id="up_info">Tải ảnh lên</span><input style="visibility: collapse; width: 0px;display:none" type="file" onchange="upload(this.files[0])" id="input_frm"/>
<img id="hinh"></img>
<script type="text/javascript">
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
document.querySelector("#up_info").innerHTML='Đang tải lên';
var fd = new FormData();
fd.append("image", file);
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://uploads.im/api?upload");
xhr.onload = function() {
document.querySelector("#up_info").innerHTML='Đã tải lên ^ok^';
var link = JSON.parse(xhr.responseText);
document.querySelector("#hinh").src=link.data.thumb_url;
console.log(link);
}
xhr.send(fd);
}
</script>
code hệt imgur nhỉ.mới kiếm đc api mới à.có ổn định k
({"status_code":200,"status_txt":"OK","data":{"img_name":"abcde.png","img_url":"http:\/\/s1.uploads.im\/abcde.png","img_view":"http:\/\/uploads.im\/abcde.png","img_width":167,"img_height":288,"img_attr":"width=\"167\" height=\"288\"","img_size":"36.1 KB","img_bytes":37002,"thumb_url":"http:\/\/s1.uploads.im\/t\/abcde.png","thumb_width":100,"thumb_height":90,"source":"http:\/\/www.google.com\/images\/srpr\/nav_logo66.png","resized":"0"}});
json của nó đây rồi :)))))
HTML5
({"status_code":200,"status_txt":"OK","data":{"img_name":"abcde.png","img_url":"http:\/\/s1.uploads.im\/abcde.png","img_view":"http:\/\/uploads.im\/abcde.png","img_width":167,"img_height":288,"img_attr":"width=\"167\" height=\"288\"","img_size":"36.1 KB","img_bytes":37002,"thumb_url":"http:\/\/s1.uploads.im\/t\/abcde.png","thumb_width":100,"thumb_height":90,"source":"http:\/\/www.google.com\/images\/srpr\/nav_logo66.png","resized":"0"}});json của nó đây rồi :)))))
ổn định mà, không cần key