Jump to content

Deleting media


Recommended Posts

Doesn't seem to do anything.

I'm trying $page->images->removeAll()

I'm also finding junk files in an example page that aren't in the images field. I'm thinking these are a result of interrupted saves or something like that. Isn't there a way to just delete the assets directory for the page?

Link to comment
Share on other sites

With a little help from another post from Ryan, I got this:

$dir = $page->filesManager->path;
$dit = new DirectoryIterator($dir);
foreach($dit as $df) {
  unlink($df->getPathname());
}
rmdir($dir);
$pages->uncache($page);

And away go all assets from said page.

Link to comment
Share on other sites

Doesn't seem to do anything.

I'm trying $page->images->removeAll()

I'm also finding junk files in an example page that aren't in the images field. I'm thinking these are a result of interrupted saves or something like that. Isn't there a way to just delete the assets directory for the page?

I bet you forgot to save  :)  ;)

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...