I am fetching some images with javascript from a route call, and I need to set the correct srcset attribute:
return `
<img class="image"
`srcset="${item.image_path}${item.image_name}-600x.jpg 600w
${item.image_path}${item.image_name}-1200x.jpg 1200w
${item.image_path}${item.image_name}-1600x.jpg 1600w"
sizes="(max-width: 500px) 100vw, (max-width: 1200px) 40vw, (max-width: 2200px) 30vw, 25vw"
src="${item.image}"
alt="${item.alt}">
`
$file->url() returns the whole url, but I need to interpolate the size part in it.
How can I get the path of the file (${item.image_path} in the example), without the filename and extension?