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.

Ionic 3.9.2 Some Images are loaded some not

See original GitHub issue

Hi, trying to implement your Module to Lazy Load Images. I’m using Ionic with Shopify. Therefore i catch Images from a CDN.

But i cannot get it working it should. As you can see, the images on the right side are loaded, but not all

image-2

Home.html

<ion-content #homecontainer>
    <ion-item color="dark">
        <img src="/assets/images/myspaeti-logo@2x.png" class="home__logo">
    </ion-item>

    <ion-grid>
        <ion-row class="row__home">
            <ion-col col-6 col-sm-4 *ngFor="let item of collections" tappable (click)="openCollection(item)">
                <div class="home__category">
                    <div class="home__image">
                        <img [defaultImage]="'https://www.placecage.com/1000/1000'" [lazyLoad]="item.attrs.image.src" [offset]="offset" [scrollTarget]="homecontainer.scrollElement">
                    </div>
                    <div class="home__title">
                        {{item.attrs.title}}
                    </div>
                </div>
            </ion-col>
        </ion-row>
    </ion-grid>
</ion-content>

When i inspect the code i get this Image that has been loaded

<img ng-reflect-lazy-image="https://cdn.shopify.com/s/file" ng-reflect-default-image="https://www.placecage.com/1000" src="https://cdn.shopify.com/s/files/1/2262/0831/collections/Susswaren_Collection.jpg?v=1524510650" class="ng-lazyloaded">

Image that has not been loaded

<img ng-reflect-lazy-image="https://cdn.shopify.com/s/file" ng-reflect-default-image="https://www.placecage.com/1000" src="https://www.placecage.com/1000/1000">

Do i miss something?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
magic-77commented, Aug 20, 2018

@tjoskar This works for me now.

1reaction
tjoskarcommented, Aug 16, 2018

@magic-77, I tested your code now and it seems to work if you set a proper width and height on the image.

eg.

<div class="home__image">
-   <img [defaultImage]="defaultImage" [lazyLoad]="setImage(item)" [scrollObservable]="homecontainer.ionScroll">
+   <img width="100%" height="100%" [defaultImage]="defaultImage" [lazyLoad]="setImage(item)" [scrollObservable]="homecontainer.ionScroll">
</div>

I’m not total sure what the problem was but it is alwas a good idea to set a width and height on the images.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When generating the Build for IOS, the images in the assets ...
Using Ionic Serve, opening in the browser, the images load ... But by doing a build and installing on an iPhone, the images...
Read more >
Image is not loading in Ionic 3 - Stack Overflow
I am working on ionic 3. I updated ionic-cli, nodejs and cordova versions in the project. After updating the version, the images are...
Read more >
How to Cache Image Files with Ionic & Capacitor - YouTube
If you want to implement caching inside your Ionic app and want to make sure your images are locally available as well, you...
Read more >
Ionic images not loading after running app on an iOS device ...
This is due to a path issue with the root of your app. Making the path relative will stop any confusion. Share. Topic...
Read more >
Ionic 4 Loading local image not working on IOS but ... - Reddit
I'm trying to load a image from users phone, crop it and then display. Im using the webview plugin to do that. It...
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