Sign in to follow this  
Teonnyn

Phaser 2 is sometimes incorrectly loading remote images?

Recommended Posts

I have a system where I'm trying to load images from two sources remotely. They work half the time... but then a third of that, it suddenly attempts to add an additional http to the domain which causes the load to fail. I'm not 100% sure what is going on here, and it's been baffling. Part of it is that the images are being loaded in a loop - could that be causing the issue?

This is the error that I'm getting: error loading asset from URL https:https://images.igdb.com/igdb/image/upload/t_thumb_2x/arlh24mn9p9x5blpuxqb.jpg

This is the code I'm currently using:

  populateGameData(data)
  {
    if (this.gameData.length < 0)
    {
      for(let i = 0; i < this.gameData.length; i++)
      {
        this.game.cache.removeImage(this.gameData[i]['id']);
      }
    }

    this.gameData = [];

    this.gameData = data['gameData'];

    for(let i = 0; i < this.gameData.length; i++)
    {
      game.load.image(this.gameData[i]['id'], this.gameData[i]['gameImage']);
      
    }

    setTimeout( () => {
      game.load.start();
    }, 3500 );      
   
    game.load.onLoadComplete.add(this.loadCheck, this);
    
    
   
  }


  loadCheck()
  {
    console.log(this.gameData[0]['id']);
    //let testImage = game.add.sprite(0, 0, this.gameData[0]['id']); 
      
  }

I do have allowed access to the images through Cors - has anyone else run into this problem before?

 

Share this post


Link to post
Share on other sites

I solved it. The issue turned out to be in the database, one of the images had an extra https:// attached to it that was getting corrected on the site, but was fooling Phaser.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.