i just realised that, changing the flag size, only changes the height and width attribute of the img-tag. the image itself always has the same size and turns blurry if you set it higher.

this problem would be solved by using a vector format.

I know that only modern browsers support svg but maybe we can use the current images as a fallback somehow

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

loominade’s picture

there is actually a javascript based method to add a fallback:

<img src="en.svg" onerror='this.onerror=null; this.src="en.png"' />
Freso’s picture

Status: Active » Postponed

This is actually quite an interesting prospect. This would also make it possible to "jack" almost all the flags straight from Wikipedia, without having to run them through my string of commands to make them PNG files first.

It's not going to make it into 7.x-1.x though, but for a future 7.x-2.x, it might be a possibility. I'll postpone it for now. Thank you for the suggestion though!

Freso’s picture

Having had this in the back of my mind for a few days, it turns out I actually really, really like the idea.

Is there any way, you know of, to load .png per default and switch to .svg if it's supported? Problem is, browsers that do not render SVGs are likely to not run JavaScript either. (I'm having e.g. "links -g" in mind.)

loominade’s picture

I'm afraid there is no way to create a fallback or polyfill without javascript

Freso’s picture

I think you may have misunderstood me. I wanted to use SVG as the "fallback", defaulting to PNG. If the browsers runs JavaScript and otherwise supports SVG images, then load the SVG instead of the PNG. Am I making sense or just on a late night ramble? :)

Matroskeen’s picture

Just because svg it's cool :)

Tested on the latest release of Drupal 7 and 7.x-1.1 language icons branch.

Status: Needs review » Needs work

The last submitted patch, 6: languageicons_svg_icons-1343422-6.patch, failed testing.

Matroskeen’s picture

Little fix to make PHP 5.3 happy.

Status: Needs review » Needs work

The last submitted patch, 8: languageicons_svg_icons-1343422-8.patch, failed testing.

Matroskeen’s picture

Status: Needs work » Needs review
FileSize
9.08 KB

More fixes to make PHP 5.3 happy.

Status: Needs review » Needs work

The last submitted patch, 10: languageicons_svg_icons-1343422-10.patch, failed testing.

Matroskeen’s picture

Status: Needs work » Needs review
FileSize
9.09 KB

lol :) let's remove this test at all :)

Status: Needs review » Needs work

The last submitted patch, 12: languageicons_svg_icons-1343422-12.patch, failed testing.

Matroskeen’s picture

Status: Needs work » Needs review
FileSize
9.09 KB

PHP 5.3 <3