Giter VIP home page Giter VIP logo

Comments (10)

akzhy avatar akzhy commented on June 15, 2024

Hey,
To add images from static folder, you can simply use /images/imagename, but please note that this method is really disadvantageous because if you source images from the static folder, there won't be a blur up preview or screen resolution based images. It is better to use the conventional method.

from gatsby-starter-elemental.

Hrishikesh-K avatar Hrishikesh-K commented on June 15, 2024

Hello.

I tried it even before and now, again. The path /images/imagename doesn't work, however, I see what you say. Even though I'm not a fan of those blurred up images, the resolution based images are kinda important. I just had to use it because I had to use site logo from static folder, so, I thought, why create a copy.

from gatsby-starter-elemental.

akzhy avatar akzhy commented on June 15, 2024

To use in frontmatter you will have to change some queries, but this will break all the other images that are not in the static folder. I would say making a copy will be better for the long run for the users of your site.

from gatsby-starter-elemental.

Hrishikesh-K avatar Hrishikesh-K commented on June 15, 2024

I've now taken a full backup. If I may ask, which queries would they be?

from gatsby-starter-elemental.

akzhy avatar akzhy commented on June 15, 2024

There are a couple of files you will have to change, you will basically have to replace

image {
    publicURL
    childImageSharp {
        fluid(maxWidth: 1920) {
            srcSet
            ...GatsbyImageSharpFluid
       }
    }
}

with

image

This will simply retrieve the URL as it is given (without gatsby manipulations) and then you will have to replace gatsby-image <Img> component with the normal <img> component.

The queries are located at src/components in the files list- and src/templates/list-
The component is at src/components in the files item-

list- => list-portfolio.js and list-blog.js

from gatsby-starter-elemental.

Hrishikesh-K avatar Hrishikesh-K commented on June 15, 2024

It seemed an easy task, but, this error pops-up: Field "image" of type "File" must have a selection of subfields. Did you mean "image { ... }"?

from gatsby-starter-elemental.

akzhy avatar akzhy commented on June 15, 2024

Hey, It probably means that you have some image that is still using the conventional method somewhere. For static to work, you will have to make sure that all of the images (in all pages) are in the static folder.

from gatsby-starter-elemental.

Hrishikesh-K avatar Hrishikesh-K commented on June 15, 2024

It was the case before, but, now, I replaced all image paths in all pages in the contents folder. Unfortunately, the same error exists.

from gatsby-starter-elemental.

akzhy avatar akzhy commented on June 15, 2024

Try gatsby clean

from gatsby-starter-elemental.

Hrishikesh-K avatar Hrishikesh-K commented on June 15, 2024

That worked. At first, it gave a lot of errors in various files in templates folder, but, I went ahead and tried to fix them all. Then, the images had lost their size styling, but, I added some CSS which fixed that. Great work sir, great template, everything just amazing. Thank you!

from gatsby-starter-elemental.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.