Copied to clipboard

Flag this post as spam?

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


  • Sotiris Filippidis 286 posts 1501 karma points
    Apr 12, 2017 @ 16:42
    Sotiris Filippidis
    0

    Deleting media

    Is Nexu supposed to warn me when deleting media?

    I added an image to a page (via a MultipleMediaPicker), published it, and then I went to the image in Media and deleted it - no warning was issued. Should a warning be issued or doesn't Nexu track media relations to pages? Or maybe I'm doing something wrong?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 12, 2017 @ 17:46
    Dave Woestenborghs
    100

    Hi Sotiris,

    Nexu should track media and warn you when deleting it. There is only one case where this is not working (yet). That is in the list view when you select media items there and try to delete it. But when right clicking the media item in the tree it should warn you if there are relations.

    Maybe you can check the following. Got to the developer section and then to Relation Types.

    Open the relation type "Nexu Document To Media" and go to the tab Relations. Check if there is a relation for the document node to the media item.

    If yes, please check if you see errors in the browser console when right clicking the media item.

    If no. Can you save the conten item again and check the Umbraco logs for any errors.

    Dave

  • Sotiris Filippidis 286 posts 1501 karma points
    Apr 12, 2017 @ 19:33
    Sotiris Filippidis
    0

    That must be it - I deleted it from the list view, not from the tree.

    I also tested what you suggested and yes, there was a relation there. I right-clicked the image in the media tree and chose "delete" and it warned me as it should. I then deleted the item from the picker (not the item itself, the reference to it from my document) and rechecked the relations - it was gone as it should.

    So I assume it works correctly when right-clicking, but not when deleting from the list view as you said. Any ETA on warnings when using this method of deletion? It could be very useful since we can't force clients to only use the right-click method. (Well, as you know I can try, they'll say "ok" and next thing you know they'll delete a bunch of items from the listview :) )

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Apr 12, 2017 @ 19:40
    Dave Woestenborghs
    1

    Hi Sotiris,

    Like i said the issue is known and planned for version 1.2.0 (https://github.com/dawoe/umbraco-nexu/issues/8)

    The problem is that I need to think of a fix that works in all supported umbraco versions. For example 7.3.0 doesn' t have this option in the list view.

    Dave

  • Sotiris Filippidis 286 posts 1501 karma points
    Apr 12, 2017 @ 19:52
    Sotiris Filippidis
    0

    I understand the difficulty. In any case, it's an extremely useful package and I'm definitely going to add it to my list of things to install with new Umbraco setups! Thanks!

  • David Armitage 510 posts 2081 karma points
    Jun 21, 2020 @ 04:06
    David Armitage
    0

    Hi Guys

    Anyone having trouble with Umbraco 8. Here is how I do it.

    public void DeleteMedia(int mediaId)
            {
                try
                {
                    IMedia media = _mediaService.GetById(mediaId);
                    if(media != null)
                        _mediaService.Delete(media);
    
                }
                catch (Exception e)
                {
                    _logger.Error<UmbMediaService>("DeleteMedia | Exception: {0} | Message: {1}", e.InnerException != null ? e.InnerException.ToString() : "", e.Message != null ? e.Message.ToString() : "");
                }
            }
    
Please Sign in or register to post replies

Write your reply to:

Draft