mindkomm / timmy

Advanced image handling for Timber.
MIT License
171 stars 13 forks source link

IE10/11 failed displaying image because of src with base 64 value #13

Closed Mahjouba91 closed 5 years ago

Mahjouba91 commented 6 years ago

How can I fix that please, I can't handle IE10/11 support because of that

Mahjouba91 commented 6 years ago

if you won't change this behavior, could you at least add some filters to be able to change it.

gchtr commented 6 years ago

Salut @Mahjouba91

Just to confirm: Did you install Picturefill in combination with Timmy?

But I agree with you that it would be nice if this behaviour could be changed through a filter. I’ll work something out.

Mahjouba91 commented 6 years ago

Bonjour :)

Thanks for your answer

I don't see Picturefill in my project, Do I have to install it ?

gchtr commented 6 years ago

Srcset and sizes attributes are not supported in IE10/11, that’s why you could use the Picturefill polyfill to make it work in those browsers. I suggest you try it and see if it works.

I know I didn’t make this clear enough in the Readme, maybe I could improve this as well.

Mahjouba91 commented 6 years ago

Thanks, I will try it.

Yeah it will be definitely a nice thing to improve the readme for this specific behavior

kuuak commented 5 years ago

Hello @gchtr ,

Any update on this possible filter to override the default base 64 value in src attribute ? In our projects, we don't use Picturefill but object-fit-images polyfill, which uses the src value to put a background-image on browser that don't support object-fit.

We need therefor, to have the original image url in the src attribute instead of the base 64.

Thanks

gchtr commented 5 years ago

Hey @kuuak

I just released a release candidate for your request: https://github.com/mindkomm/timmy/releases/tag/0.14.2-rc.1.

Could you please check out if that works for you? My guess is that with that version and the following filter, you’re good to go:

// Use the default src URL as a fallback.
add_filter( 'timmy/src_default', function( $src_default, $attributes ) {
    return $attributes['default_src'];
}, 10, 2 );
ybc37 commented 5 years ago

Hey @gchtr, hey @kuuak,

I was just having the exact same issue (also using object-fit-images polyfill). Upgrading to 0.14.2-rc.1 and adding the filter worked :)

@gchtr: Thanks for this filter! Is there an ETA for a new timmy version?

gchtr commented 5 years ago

@nesmyslny Probably this week 😉. I’ll keep you posted.

ybc37 commented 5 years ago

Great, thanks! I don't want to stress at all, I'm just trying to figure out, if we need to ship the RC or if we can wait till the release :wink:

gchtr commented 5 years ago

@nesmyslny I just released 0.14.2 together with some more improvements.

I found that if we use a slightly different value for the default base-64-encoded value, we don’t get any errors in IE. So the 0.14.2 release should fix IE errors by default. But now you also have the filters that allow you to change Timmy’s behavior in case you need something different.