Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 15:16
    dominik
    0

    delete media type item - image is not deleted

    Hello,

    I got the following problem:

    If i delete a media type item the image which is used inside this media type item is not deleted and still exists.

    How can i achieve that this images is also deleted

     

    Thanks

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 22, 2011 @ 15:26
    Tom Fulton
    1

    Hey dominik,

    Are you referring to the fact that when you delete a media node, the image remains on the hard disk?  If so this is the default Umbraco behavior unfortunately.  To remove the file you have to click the "remove file" checkbox and Save before you actually delete the node.

    However, one could write an Event that automatically deletes the physical file when the node is deleted, pretty easily.  There's an example in this post

    There are also some packages that aid in finding "rogue" images and deleting them. FALM Housekeeping comes to mind but if I recall it only works when you using the flat media structure (ie /media/1111-file.jpg instead of /media/1111/file.jpg).  I also think Richard Soeteman is working on a SiteAnalyzer package which will assist with this (although I think it will be commercial).

    Events are probably the best way to go if this is an issue for you.

    -Tom

  • Pasang Tamang 258 posts 458 karma points
    Mar 22, 2011 @ 15:27
    Pasang Tamang
    0

    I'm also facing same problem in umbraco v 4.5.2. Any solution please?

  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 15:31
    dominik
    0

    i just tried it. If i check "remove image" the folder with the id still exists. Also if i delete the media type item.

    How can i delete the whole media item (including image, media folder) etc.

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 22, 2011 @ 15:36
    Tom Fulton
    0

    You would need to write a custom event to handle this, using the OnBeforeMediaDelete trigger.  In here you could look up the umbracoFile property and delete the file & folder.  Not sure if you are familiar with C# or not but here are some good starting points on Events:

    http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events
    http://www.richardsoeteman.net/PermaLink,guid,f470b6cf-40da-4aa9-a0d9-7b984fe9bf59.aspx  (appears to be down at the moment)

    And as I mentioned earlier a similar example

    -Tom

  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 15:38
    dominik
    0

    i do not know c# so it is very hard for me to handle this

    Thought there must be an easier solution to delete images completly :-(

  • Fergus Davidson 309 posts 588 karma points
    Mar 22, 2011 @ 15:59
    Fergus Davidson
    1

    sorry if you have done this already, but have you emptied the recycle bin in the media section?

    deleted items are still contained in the recycle bin. emptying should get rid of the folders and the images.

    i have just tested on one of our sites and images and folders are removed completely.

    if this still does not work - perhaps a permissions issue??

  • dominik 711 posts 733 karma points
    Mar 22, 2011 @ 16:03
    dominik
    0

    i just tryed it but the empty folder still exists

  • Craig100 1136 posts 2523 karma points c-trib
    Nov 07, 2020 @ 14:57
    Craig100
    0

    Nine years later this is still an issue.

    I need something that will check for unused images and delete them from disk. Also check for empty image nodes and delete them if there's no file on disk. (V7)

Please Sign in or register to post replies

Write your reply to:

Draft