Skip to content

When a Livewire component changes only the tiny placeholder if the image is shown. #2548

Answered by landg16
stefro asked this question in Q&A
Discussion options

You must be logged in to vote

I have found another, and I think better solution for this.

First of all you have to publish media library resources:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="views"

After you publish resources, open: resources/views/vendor/media-library/responsiveImageWithPlaceholder.blade.php
You will see, that when onload function is called, it's getting null as soon as this function is getting called. all you have to do, is to remove onload=null; from onload function, and your file will look like this:

<img{!! $attributeString !!} @if($loadingAttributeValue) loading="{{ $loadingAttributeValue }}"@endif srcset="{{ $media->getSrcset($conversion) }}" …

Replies: 11 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@faxunil
Comment options

@faxunil
Comment options

@landg16
Comment options

@faxunil
Comment options

@Saifallak
Comment options

Answer selected by freekmurze
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@madurapa
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@RhysLees
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #2290 on August 17, 2021 20:57.