question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Download external images with the extension that it really is

See original GitHub issue

In https://github.com/mdn/content/pull/1587 @nschonni and I discovered that some images might be called foo.jpg but on closer inspection, it’s actually a image/png so the name is wrong. Who knows how many of these there are? The filecheck command will eventually catch you if you run the fixable flaws on external images that get downloaded to disk. Inconvenient when you have to manually correct it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
peterbecommented, Jan 28, 2021

How do you check them? As far as I know there are „magic bytes” at the beginning of the image binary which can help deciding on the image.

I know, we decided to add images to the repo going forward, but an alternative might be to use an image CDN, which then would convert images on-the-fly. Could be used in the future, if the repo gets too large.

We use https://www.npmjs.com/package/file-type

0reactions
Ryuno-Kicommented, Jan 23, 2021

I was hinting on https://en.wikipedia.org/wiki/List_of_file_signatures or https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files

On *NIX systems, you have the file CLI for this. Perhaps @peterbe found another way to do it (e.g. with Node tools). Thus my question.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image Downloader
Image Downloader ━━━━━━━━━━ If you want to download many images at once, with this extension you can: - Explore images on the ...
Read more >
How to Download All Images on a Web Page at Once - wikiHow
1. Open Google Chrome or Microsoft Edge. If you have Google Chrome or Edge installed on your computer, you have a variety of...
Read more >
How to Develop an Extension to Download Images from Google
To develop the extension to download images, We first need a manifest file. The first step is to create a file called manifest.json...
Read more >
Chrome doesn't always add file extension to downloaded ...
Manually putting a .png extension onto the Golden-Gate-Bridge-Xlg-1233898474 file that is actually of type image/jpeg will complicate things ...
Read more >
Download all Images extension - Opera add-ons
Sites that hide image links inside an svg put inside an external document loaded into an object tag! ... Very good extension. always...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found