我们刚刚开始在项目中使用Filepicker.io,并且有关于渲染缩略图的问题。我们的first test image似乎没有被Twitter识别为图像。这意味着所有用户都会看到链接而不是缩略图。
是否有任何解决此问题的方法,可能使用某种自定义网址或可选参数?
更新
这是我正在使用的代码:
<div class="upload-image">Drop files here</div>
// init filepicker plugin
filepicker.makeDropPane($('.upload-image'), {
multiple: true,
dragEnter: function() {
$(".upload-image").html("Drop to upload").css({
'backgroundColor': "#E0E0E0",
'border': "1px solid #000"
});
console.log('enter');
},
dragLeave: function() {
$(".upload-image").html("Drop files here").css({
'backgroundColor': "#F6F6F6",
'border': "1px dashed #666"
});
},
onSuccess: function(fpfiles) {
$(".upload-image").text("Done, see result below");
$.sticky('Your file was uploaded successfully.');
console.log(JSON.stringify(fpfiles));
},
onError: function(type, message) {
// $("#localDropResult").text('('+type+') '+ message);
$.sticky('Your file was uploaded successfully.');
},
onProgress: function(percentage) {
$(".upload-image").text("Uploading ("+percentage+"%)");
}
});
答案 0 :(得分:0)
如果twitter(或实际上任何其他服务)正在执行简单的正则表达式,基于URL确定文件是否为图像,那么您可以做的一件事就是将+ filename.jpg附加到图像的末尾。例如:
https://www.filepicker.io/api/file/JhJKMtnRDW9uLYcnkRKW和 https://www.filepicker.io/api/file/JhJKMtnRDW9uLYcnkRKW+fry.png
两者都指向相同的内容,但推特可能会对第二种内容感到满意。