How do I load an image URL from within the project?

0 favourites
  • 7 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • Hello, I'm trying to load an image that is in the project and I'm getting the following error in the console

    	Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://editor.construct.net/r204-2/preview/112_necklace.png. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
    

    If you see, it's the construct preview URL, the file "112_necklace.png" exists normally in the Files/Content folder. Am I missing something here?

  • Put this before your URL:

    https://cors-anywhere.herokuapp.com/

    Example:

    https://cors-anywhere.herokuapp.com/https://i5.walmartimages.ca/images/Enlarge/094/514/6000200094514.jpg

  • Put this before your URL:

    https://cors-anywhere.herokuapp.com/

    Example:

    https://cors-anywhere.herokuapp.com/https://i5.walmartimages.ca/images/Enlarge/094/514/6000200094514.jpg

    Will this work for any URL cause for the pics in the project I get a 404 error.

    Thank you so much for the reply! :D

  • What did you put in the URL? If the file is included in the project, the URL should be simply "filename.jpg"

  • What did you put in the URL? If the file is included in the project, the URL should be simply "filename.jpg"

    Yeah that was the problem, I'm putting "filename.png" and it gives me the error I posted, you can find the URL that it's searching at in my first post. I'm getting the images straight from the server now tho, thank you very much! :D

  • Is there a solution to that? I have another project where I'm trying to load images from within the project and I'm getting the same error and we have no images on the server.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Add a screenshot to see your project, because as dop2000 say you only need to add "filename.jpg"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)