# Resource API change

**URL:** <https://forums.realmacsoftware.com/t/resource-api-change/47490>\
**Category:** Elements\
**Created:** [May 9, 2025, 2:44pm UTC](https://forums.realmacsoftware.com/t/resource-api-change/47490 "2025-05-09T14:44:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [May 9, 2025, 2:44pm UTC](https://forums.realmacsoftware.com/t/resource-api-change/47490/1 "2025-05-09T14:44:56Z")

</div>

This changes at some point and broke some stuff.  
When using a resource control to drop galleries of images into a component.

```auto
        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:

```auto
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;

```

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [May 9, 2025, 6:03pm UTC](https://forums.realmacsoftware.com/t/resource-api-change/47490/2 "2025-05-09T18:03:50Z")

</div>

@Doobox Good catch! I can replicate this here and it is indeed a bug, I’ll get it fixed up.

The @900 appended to the filename is because you requested the image at that size. [Elements](https://elementsapp.io/) automagically resizes images and stores them along side the original image. It’s great for generating thumbnails etc.

---

<div class="post-metadata">

**Author:** ![tpbradley](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tpbradley/32/25503_2.png) [@tpbradley](https://forums.realmacsoftware.com/u/tpbradley)\
**Post date:** [July 17, 2025, 8:07am UTC](https://forums.realmacsoftware.com/t/resource-api-change/47490/3 "2025-07-17T08:07:33Z")

</div>

@Doobox Sorry it’s taken a while to get to this! There’s a fix in [Elements 1.0.6 (23722)](https://forums.realmacsoftware.com/t/elements-1-0-6-23722/48916) so please give it another go.

Cheers
