__louis___
10/16/2023, 12:38 PMkdxperbol
10/16/2023, 12:47 PM__louis___
10/16/2023, 12:58 PMjs
mediaResource.getById(1000) // get media item with image i'd like to replace
.then(function(media) {
mediaResource.save(media, false, [file]) // this is a File object created with the HTML File API, but I've also tried Blobs and direct image paths
.then(function(media){
alert("Retrieved, updated and saved again");
})
.catch(function(error) {
console.error("Error saving media:", error);
});
})
.catch(function(error) {
console.error("Error fetching media:", error);
});