0

I am importing images in different scales and show them in my react app

some images are import correctly, but some get really long and "strange" string name instead of their regular file name

for example

import generator from '../images/generators/generator-rental.jpg';
import generatorw205 from '../images/generators/generator-rental@0,4x.jpg'; 
import generatorw384 from '../images/generators/generator-rental@0,75x.jpg'; 

when I put 3 of them together in srcSet the smallest image get the long string.

the generatorw205 and generatorw384 are imported correctly and shown with this src property:

"/_next/static/images/generator-rental-9f9671c1ae14a9abd201cce092b95c0d.jpg 512w"

and

/_next/static/images/generator-rental@0,75x-0ff42525965adeb23850ef8dacd34c50.jpg 384w,

but the first image get this string:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/7gAOQWRvYmUAZMAAAAAB/9sAhAAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQyAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wgARCACZAM0DASIAAhEBAxEB/8QAHAABAAEFAQEAAAAAAAAAAAAAAAYBAwQFBwII/9oACAEBAAAAAO/gAAAAjWF5orWpSvvx51fMn0Vlg1GPvfQAYemkoCI6bxqNdvcrXe83Loo9WbFy/Y4LkevrPA5l0LK+Zs7b+MHmXeu3g0NmCdauW1L2k1Mv4hBL13xhwzt3QrGfYwdZMdpAulgwOW6qH7TCk0n90t+fLHiWTelnjqoKcq2sHhZvsvP2Eeue6YvrMkWb00DnM++RtJvort/Us3vG7Ki72X6G530UDnnn5x2G4sb3axuN9XxrHjz7gf1tEJwBzzA+bN/J7XQfUDjHX7VK1ry76j00vAhN/wCVsyUTNXmmD2iox8Dq6QARbcY3zZfkGDnaSNfR6lvQaL31DN3AGmw5K4Brbl7vuPsrOrsXuFy+US7KApAd0gGBzu516UY2RtNjD7F7TdSqAYnjG+T9XV9Oz0RCSZfO+iAAp8Y2buL9EdSERk92A9AAA5d872JD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R27A8VV4bUuI5qM2WmVw7MrT60dm5dDrB2buBVNE5jf5onH8hs+wRMQYczHD87KnEzp42SX3jf1MU9kwydzhyNITh3Jy3K4VwqmETxGMqs9qtgb9T1MXbelLu4goG4umix2Jp9USnuss4XOBSSloFvmQP2n+1iTfRvUr2Z6Z49FSOzwMPoE7KDYp89OdhUEzZScm4IgHepqmmh/scAo6ulqDliftVTibC5rIzexBUBD8QkcPk0dU0M8Xwslh3EXVVh2ITuDjILjuuFQYVDTsGcZnLmw1pEexadPL8RMT6DYocMpYvdYsWiYKYyWs5trFR4BTkB7ibrCoyyaYE3sQOHXO5NuAATc8tbT9IgdEhX1AGV0JzfriqGB8TCZPecbn/D//xAArEQACAgAEBAUEAwAAAAAAAAABAgADBBEUIRASIFETMTJikTNBUmEjMED/2gAIAQMBAT8A4DDWGaZ+4+Zp27j5mmbuPmaZu4+Zpm7j5mlfuPmNhXXzy6KqmsOSyvCBWBdhHwxZixcTSe8TSe4TS+8TSe8TSe8RcJv6hLcK1jlgRDhD+Q40MUoJUZnOE2FuZpyt2mRmR4BSTkIVIGcoGdizC2HxWH23PRgXCo2csvVmzV4bffKr6h6mE1FHcTx6fyE8ar8hHKt6XAgQ57OscoEYr0YXcOvccHVl8xAYOit+RuaU7UuejCH+UDhZYz5cxzyhgEAnLOQxUzO8G2GP7PRQcrFMtGVhEGcFdssQoN/MzOJXY/pENVte7CV4Y7lpYOXDqP30+Oj/AFVzMqxGHQZBTLsU9h22E5iTm281CL9NI+JtbzMwjMbAv2MbH2AkACYtgyJ/QeNNnhuGhoQ7hxlLrA5AXyH+H//Z 205w,

And this is my next.config.js file:

const withImages = require('next-images')
const withPlugins = require("next-compose-plugins");
const optimizedImages = require("next-optimized-images");
const withBundleAnalyzer = require('@next/bundle-analyzer')({
    enabled: process.env.ANALYZE === 'true'
  })

module.exports = withPlugins(
    [
        [optimizedImages, {

        }],
        [withBundleAnalyzer, {
            
        }]
    ]
);

1 Answer 1

1

Update

For next-optimized-images. The plugin has similar config - https://github.com/cyrilwanner/next-optimized-images#inline

module.exports = withPlugins(
    [
        [optimizedImages, {
           inlineImageLimit:4096
        }],
        [withBundleAnalyzer, {
            
        }]
    ]
);

some images are import correctly, but some get really long and "strange" string name instead of their regular file name

The strange string name is the base64 representation that can be supplied to data url's by employing this technique you can avoid additional http downloads from the server.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi, thank you, it sounds like you are right, I have edited and added my next.config.js code because I am not using "next-images" but "optimizedImages" package, do you know how I can set it in order for that fix?
Edited for next-optimized-images

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.