Sourcecode in ImageMgr/objectFunctions.js:
1: function deleteImage(imgObj) {
2: // first remove the image from disk (and the thumbnail, if existing)
3: var dir = imgObj.site ? imgObj.site.getStaticDir("images") : imgObj.layout.getStaticDir();
4: var f = new Helma.File(dir, imgObj.filename + "." + imgObj.fileext);
5: f.remove();
6: if (imgObj.thumbnail) {
7: var thumb = imgObj.thumbnail;
8: f = new Helma.File(dir, thumb.filename + "." + thumb.fileext);
9: f.remove();
10: thumb.remove();
11: }
12: if (imgObj.site)
13: imgObj.site.diskusage -= imgObj.filesize;
14: // then, remove the image-object
15: imgObj.remove();
16: return new Message("imageDelete");
17: }
|