-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED] Allow QuickView image preview for arbitrary URLs missing image known extension #9491
Comments
Comment by humphd Something like this: humphd/brackets@542cd1d |
Comment by MarcelGerber
Thus, I'd suggest two things, maybe do both, maybe just of them:
|
Comment by humphd Browsers already do the optimization you suggest per the HTML spec. Specifically, if an Adding a black-list of extensions to ignore (html, json, css, ...), which are specifically known to not yield useful previews would probably be good. I'll add that to my patch. |
Comment by MarcelGerber I suggested to do a HEAD request first so the browser doesn't need to download the whole file. |
Comment by humphd My PR is updated. Also, I confirmed that Firefox does in fact do what I said above, namely, if you try to use a 50M JSON file as the |
Comment by MarcelGerber I wouldn't call Chrome's behavior a bug -- usually, HTML is used on normal webpages, where an |
Issue by humphd
Monday Mar 23, 2015 at 20:22 GMT
Originally opened as adobe/brackets#10786
Currently the code for QuickView's image preview depends on a URL having a known image extension:
This is fine in the general case, but falls down when you use an image from a web service. For example, my gravatar image is https://avatars3.githubusercontent.com/u/427398, which will fail this regex and shows no preview, despite the fact that the image can be loaded correctly.
I think this can be improved. Since the preview container is not shown until the preview
img
element'sload
event fires, it would be possible to simply try loading a given URL without bothering to check the extension at all. The current code is:After setting the
img.src
to the URL, there are two outcomes: aload
orerror
event. In theload
case, the preview would be shown as normal; in theerror
case,hidePreview()
could be called to cancel the pending preview--this is possibly something that should be done anyway, for the case that an image can't be loaded via the URL (e.g., 404).Would you consider a patch to do this?
The text was updated successfully, but these errors were encountered: