I'd like to confirm if it's the expected behavior:
1) I created a document type (for an article) and added an upload property to it 2) After that, i created an article, uploaded an image and clicked save and publish
I noticed the image and thumbnail was saved under "media/816/image.jpg" and "media/816/image_thumb.jpg".
3) I deleted the document and went back to see if the image was deleted as well and for my surprise, the folder with the thumbnail was still there.
From my point of view it's a big issue because this image is not available through the media gallery and the only way to see it is accessing the media folder via ftp and even by doing that, it will be hard to identify all the subfolders which are just numbers.
The bottom line: after create and delete a few hundred articles we will end up with tons of orphan files we will be unable to identify.
Unfortunately, there is currently no built-in way to automatically delete a file when the document is deleted. I suggest you write your own eventhandler that hooks into the Document's BeforeDelete event and removes the file from the disk before the document is deleted.
I see, the eventhandler sounds like a perfect solution. Anyway, I'll be waiting for your dashboard control dawoe, it's a very interesting idea as well.
That's probably the reason. After empty the recycle bin i noticed the file/image was gone, however the thumbnail was still there. Could it be because the thumbnail is not the one associated to the databased? Don't know but the perfect behavior (for me) would be:
1- Remove file 2- Look for thumbnail on the same directory, which is "FileName+thumb+.extension" and remove it 3- If after remove both files the folder is empty, remove folder.
If the above was applyed to every file added to the website through the upload data type and every item under the media section, the only orphan files would be those the user add using the HTML editor. However, since those are visible under the media section it wouldn"t be a problem.
How to deal with orphan files?
I'd like to confirm if it's the expected behavior:
1) I created a document type (for an article) and added an upload property to it
2) After that, i created an article, uploaded an image and clicked save and publish
I noticed the image and thumbnail was saved under "media/816/image.jpg" and "media/816/image_thumb.jpg".
3) I deleted the document and went back to see if the image was deleted as well and for my surprise, the folder with the thumbnail was still there.
From my point of view it's a big issue because this image is not available through the media gallery and the only way to see it is accessing the media folder via ftp and even by doing that, it will be hard to identify all the subfolders which are just numbers.
The bottom line: after create and delete a few hundred articles we will end up with tons of orphan files we will be unable to identify.
Unfortunately, there is currently no built-in way to automatically delete a file when the document is deleted. I suggest you write your own eventhandler that hooks into the Document's BeforeDelete event and removes the file from the disk before the document is deleted.
I created a dashboard control that looks for these orphan files by doing a compare between files system and the umbraco DB.
I will package up later on a will make available.
I see, the eventhandler sounds like a perfect solution.
Anyway, I'll be waiting for your dashboard control dawoe, it's a very interesting idea as well.
I think its for revert/trash functionality.
You can chose another file then again save and publish. But later you want go back to previous version and image is still there.
Petr
That's probably the reason. After empty the recycle bin i noticed the file/image was gone, however the thumbnail was still there.
Could it be because the thumbnail is not the one associated to the databased? Don't know but the perfect behavior (for me) would be:
1- Remove file
2- Look for thumbnail on the same directory, which is "FileName+thumb+.extension" and remove it
3- If after remove both files the folder is empty, remove folder.
If the above was applyed to every file added to the website through the upload data type and every item under the media section, the only orphan files would be those the user add using the HTML editor. However, since those are visible under the media section it wouldn"t be a problem.
IMHO it is not big issue, but you can submit patch for this :-) ... or create codeplex item.
one note: you can set umbraco to create multiple thumbnails (with different sizes).
Petr
is working on a reply...
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.