This changes at some point and broke some stuff.
When using a resource control to drop galleries of images into a component.
const paths = resources.map((resource) => {
// Return a path to the resized resource
//return rw.resizeResource(resource, 900);
return resource;
})
I had to dat been using
return rw.resizeResource(resource, 900);
But at some point in time this has changes and it now tags β900β to the end of the paths, so we get a 404 to the images in preview and publish.
Hooks in full for context:
const transformHook = (rw) => {
rw.setProps({
node: rw.node
})
// Extract gallery property from node properties, setting an empty object as the default value if gallery doesn't exist
const { gallery = {} } = rw.props
// Extract the array of resources, setting an empty array as the defult
const { resources = [] } = gallery
// Loop over all resources, requesting a path to the resized resource
const paths = resources.map((resource) => {
// Return a path to the resized resource
//return rw.resizeResource(resource, 900);
return resource;
})
// Create a hasImages, true if there are any resources, false otherwise
const hasImages = paths.length > 0;
const firstPath = paths[0];
// Set hasImages and paths in the template data
rw.setProps({
hasImages,
paths,
firstPath
})
}
exports.transformHook = transformHook;