Really appreciate the examples, I kinda had this approach as a backup - I just think it's very odd that we need to write methods (same code every time) for something so generic as saving an image.
I'd really prefer to use mediaResource.save(media, isNew, files) since it seems designed for the job - but I really can't figure out what goes into files and there seems to be 0 documentation, so I think I'll go with your approach for now!
Hopefully someone here has the answer. I would be interested to see if there was a better solution too. Please let me know if you find out anything further.
mediaResource.save() for an image
Hey guys, does anyone have a working sample for the following (the "files" bit to be exact)?
The official doc only has an example for a folder, but not an Image: http://umbraco.github.io/Belle/#/api/umbraco.resources.mediaResource
Hi,
If you are trying to add an image or file I usually create a couple of helper methods to handle this.
One for an image and one for other types of files. They are slightly different.
Hope this helps
Kind Regards
David
Really appreciate the examples, I kinda had this approach as a backup - I just think it's very odd that we need to write methods (same code every time) for something so generic as saving an image.
I'd really prefer to use
mediaResource.save(media, isNew, files)
since it seems designed for the job - but I really can't figure out what goes intofiles
and there seems to be 0 documentation, so I think I'll go with your approach for now!Thanks Dave!
Hopefully someone here has the answer. I would be interested to see if there was a better solution too. Please let me know if you find out anything further.
Kind Regards
David
is working on a reply...