Giter Club home page Giter Club logo

Comments (10)

Niels-IO avatar Niels-IO commented on July 17, 2024

Hi @kevincarld,

Could you please explain the use case of "./" instead of "/" to me? Can you share an example of how you are using the ExportedImage component?

from next-image-export-optimizer.

kevincarld avatar kevincarld commented on July 17, 2024

Hi @Niels-IO , actually I think I just have the same issue as the other comments. Because the static site im exporting won't be in the root directory that's why image src's are having issue

from next-image-export-optimizer.

Rashair avatar Rashair commented on July 17, 2024

Can this be reopened? My images are not found after proper export:

Code:

  import logo from "public/images/logo.png";
...
 <ExportedImage src={logo} style={{height: "100%", width: "auto"}}
                             alt="Faces in front of each other"/>
package.json
"build:docker": "next build && next export -o .export && next-image-export-optimizer --exportFolderPath .export",

DockerFile:
WORKDIR /app/clientApp
COPY --from=builder /opt/app/.export ./

Container:
image

The app:
image
image

It seems like the path should be under images?

from next-image-export-optimizer.

Rashair avatar Rashair commented on July 17, 2024

Actually, the name is wrong:
Should be logo-opt-10.WEBP
Not logo.bc950706-opt-10.WEBP
Any idea why this random identified is added?

from next-image-export-optimizer.

Niels-IO avatar Niels-IO commented on July 17, 2024

Hi @Rashair,

After you run the command "build:docker", you should see a folder called nextImageExportOptimizer inside the .export folder. (I confirmed with the example app in this module that this is correctly working).

Then the URL in the browser would resolve as the images are stored in the nextImageExportOptimizer folder, which is indeed at the root level. The random hash is actually created by next.js as you have used statically imported images, and this is how they handle it. As the srcset uses the images with the added hash and the images in the folder nextImageExportOptimizer are named accordingly, everything matches.

Where are the optimized images placed if you run the build:docker command?

from next-image-export-optimizer.

Rashair avatar Rashair commented on July 17, 2024

There only under 'images' - nowhere else. The nextImageExportOptimizer folder does not appear. I've also tried on your example app and it works locally for me there, but not in my own app :/

from next-image-export-optimizer.

Rashair avatar Rashair commented on July 17, 2024

I think the issue is with the statically imported images - other seem to work

from next-image-export-optimizer.

Niels-IO avatar Niels-IO commented on July 17, 2024

Hi @Rashair,

I am currently a little bit clueless about how to help you further. Could you create a minimal example that reproduces the error?

from next-image-export-optimizer.

Rashair avatar Rashair commented on July 17, 2024

I think I found the issue - I have a custom distDir, it's .build, not .next.
Here's a reproduction using your example:
https://github.com/Rashair/next-image-export-optimizer-78
(The reproduction only works on the clean repo - if you don't have .next dir there, otherwise it will supposedly copied from there)

from next-image-export-optimizer.

Niels-IO avatar Niels-IO commented on July 17, 2024

Hi @Rashair,

Thank you very much! This is indeed the issue, and I found an easy fix. I will release it in the next patch version.

from next-image-export-optimizer.

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.