资源解释为文档,但使用MIME类型image / jpeg传输 [英] Resource interpreted as Document but transferred with MIME type image/jpeg

查看:3534
本文介绍了资源解释为文档,但使用MIME类型image / jpeg传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Filepicker.io来处理我的网站上的图片上传。



我也使用FancyBox来显示一个漂亮的滑块。如果我使用像 http://i.imgur.com/asdf.jpeg 这样的常规图片作为< img src = > 。这意味着我点击图片,滑块就会正确弹出。

然而,当我切换出这些静态图片url并使用我的Filepicker地址时,当我点击要打开的图片



以下是我在控制台中的Google Chrome浏览器中收到的消息:


资源解释为Document,但使用MIME类型image / jpeg传输:https://www.filepicker.io/api/file/yknn4hWSOOm2NLZYGR3O?dl=false。


任何建议? p>

  https://www.filepicker.io/api/file/yknn4hWSOOm2NLZYGR3O?dl=false 

没有图片扩展名(jpg,png,gif),fancybox doesn不知道需要处理什么类型的内容。您需要通过添加API选项type:image来告诉它:

  $(。fancybox)。fancybox({
type:image
});

记录在这里 http://fancybox.net/faq ,第6号(如果使用v1.3.4)或这里 http://fancyapps.com/fancybox/#support ,FAQ选项卡,第5号(如果使用v2.x)。



更多选项如何处理此问题,请参阅此处:
https://stackoverflow.com/a/17554660/ 1055987

I'm using Filepicker.io to handle my image uploads on my website.

I'm also using FancyBox to display a nice slider. Everything works fine if I use a regular image like: http://i.imgur.com/asdf.jpeg as the <img src="">. Meaning I click the images and the slider pops up correctly.

However when I switch out those static image url's and use my Filepicker addresses, when I click on the images to open the fancybox, the image is downloaded.

Here's the message I get in the console, on Google Chrome:

Resource interpreted as Document but transferred with MIME type image/jpeg: "https://www.filepicker.io/api/file/yknn4hWSOOm2NLZYGR3O?dl=false".

Any suggestions?

解决方案

Since your link:

https://www.filepicker.io/api/file/yknn4hWSOOm2NLZYGR3O?dl=false

doesn't have an image extension (jpg, png, gif), fancybox doesn't know what type of content needs to be handled. You need to tell it by adding the API option "type": "image" like:

$(".fancybox").fancybox({
   "type": "image"
});

That is documented here http://fancybox.net/faq, No. 6 (if using v1.3.4), or here http://fancyapps.com/fancybox/#support, FAQ tab, No. 5 (if using v2.x).

For more options how to handle the issue see here: https://stackoverflow.com/a/17554660/1055987

这篇关于资源解释为文档,但使用MIME类型image / jpeg传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆