image icon indicating copy to clipboard operation
image copied to clipboard

hash filenames with ipx

Open ghostlexly opened this issue 3 years ago • 12 comments

Hello,

IPX is generating paths like: /_ipx/images/homepage/top-slider/logo-colipays-bordeaux-gris.png?fit=fill&s=200_50

But the image file name doesn't change. How can be add hash/chunk to the file name with ipx so the file will not be cached after a new deploy.

Example: /_ipx/images/homepage/top-slider/logo-colipays-bordeaux-gris..19dm102lf.png?fit=fill&s=200_50

ghostlexly avatar Aug 12 '21 11:08 ghostlexly

It would be very interesting to be able to do this in order to cache images longer (#329).

kevinpainchaud avatar Aug 31 '21 15:08 kevinpainchaud

I have found a way to do it but it's really overkill... For now, my issue is fixed but i'm open to a any more easy methods.

ghostlexly avatar Aug 31 '21 19:08 ghostlexly

@ghostlexly how did you accomplish adding a hash?

RobbieTheWagner avatar Jul 28 '22 02:07 RobbieTheWagner

I have found a way to do it but it's really overkill... For now, my issue is fixed but i'm open to a any more easy methods.

@ghostlexly can you share any details on the approach that you took?

mikereinhold avatar Aug 24 '23 00:08 mikereinhold

It's really frustrating when someone says they found a solution and just vanish without sharing it with others.

VictorRibeiroKCX avatar Nov 11 '23 01:11 VictorRibeiroKCX

It's really frustating that this isn't supported in the first place..

bernhardberger avatar Dec 03 '23 22:12 bernhardberger

In the Nuxt2 version of this plugin, there is a staticFilename configuration that supports hash. However, it seems that this configuration is no longer available in the new version.

Red-Asuka avatar Jan 22 '24 06:01 Red-Asuka

Supporting hash is essential. Someone should take care of implementing it asap.

Hibrix-net avatar Feb 21 '24 16:02 Hibrix-net

Sorry for my late reply, I do not receive notifications on GitHub. If anyone comes across this and is looking for the solution, here it is:

export default {
  image: {
      // Generate images to `/_nuxt/image/file.png`
      staticFilename: '[publicPath]/images/[name]-[hash][ext]'
  }
}

ghostlexly avatar Feb 29 '24 11:02 ghostlexly

Sorry for my late reply, I do not receive notifications on GitHub. If anyone comes across this and is looking for the solution, here it is:

export default {
  image: {
      // Generate images to `/_nuxt/image/file.png`
      staticFilename: '[publicPath]/images/[name]-[hash][ext]'
  }
}

Hi, As @Red-Asuka already pointed above: There's no such a property for Nuxt3: https://image.nuxt.com/get-started/configuration staticFilename is only available in the previous versions of Nuxt Image, the ones compatible with Nuxt2: https://v0.image.nuxtjs.org/api/options#staticfilename

Hibrix-net avatar Feb 29 '24 11:02 Hibrix-net

Sorry for my late reply, I do not receive notifications on GitHub. If anyone comes across this and is looking for the solution, here it is:

export default {
  image: {
      // Generate images to `/_nuxt/image/file.png`
      staticFilename: '[publicPath]/images/[name]-[hash][ext]'
  }
}

Hi, As @Red-Asuka already pointed above: There's no such a property for Nuxt3: https://image.nuxt.com/get-started/configuration staticFilename is only available in the previous versions of Nuxt Image, the ones compatible with Nuxt2: https://v0.image.nuxtjs.org/api/options#staticfilename

You're right, my problem was on Nuxt2. I do not know the solution for Nuxt3.

ghostlexly avatar Feb 29 '24 11:02 ghostlexly

Sorry for my late reply, I do not receive notifications on GitHub. If anyone comes across this and is looking for the solution, here it is:

export default {
  image: {
      // Generate images to `/_nuxt/image/file.png`
      staticFilename: '[publicPath]/images/[name]-[hash][ext]'
  }
}

Hi, As @Red-Asuka already pointed above: There's no such a property for Nuxt3: https://image.nuxt.com/get-started/configuration staticFilename is only available in the previous versions of Nuxt Image, the ones compatible with Nuxt2: https://v0.image.nuxtjs.org/api/options#staticfilename

You're right, my problem was on Nuxt2. I do not know the solution for Nuxt3.

There's no obvious solution for Nuxt3 until someone decides to release a new version of Nuxt Image that supports filename hashing (that to me seems an obvious feature btw and I'm a bit surprised to don't see it there by default as it could be).

Hibrix-net avatar Feb 29 '24 11:02 Hibrix-net