Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joe Dearsley 2 posts 72 karma points
    Apr 30, 2024 @ 12:18
    Joe Dearsley
    0

    Setting value of Media picker in a plugin

    Hi,

    I have a AI image generation plugin that I am working on, and it pretty much completely works, however there is one little bug that is annoying me with it.

    I have a modal popup that allows you to generate the images and select the one that you want.

    Then I upload the image to the media library and set the value of the property editor and save the document.

    Upon saving the document, I get a max length error message from the media picker saying "Maximum 1 entries, 43 too many"

    The value I set the media picker to is umb://media/d9d2381361104faabbe26906c3fe84a7 (which is 44 characters long)

    const udi = await umImageContentCreatorService.uploadImageFromUrl(selectedImageUrl, this.configurationObject.generationModel.prompt);
    this.configurationObject.isAddingMedia = false;
    this.umbProperty.property.value = udi;
    await contentResource.save(editorState.current, false, []);
    notificationsService.success('Content created successfully.'); 
    

    Which results in:

    enter image description here

    How do I update the value of the media picker without causing this error?

    Thanks

    Joe

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies