/** * Removes the compressed file from the disk and database * * @author Woxxy * @returns bool */ function remove() { $chapter = new Chapter($this->chapter_id); $chapter->get_comic(); if (file_exists("content/comics/" . $chapter->comic->directory() . "/" . $chapter->directory() . "/" . $this->filename)) { if (!@unlink("content/comics/" . $chapter->comic->directory() . "/" . $chapter->directory() . "/" . $this->filename)) { log_message('error', 'remove: error when trying to unlink() the compressed ZIP'); return FALSE; } } $this->delete(); }
/** * Optimizes the selected image with optipng, if optipng is even available. * This function overwrites the existing images. Notice that this will be * a quite long-running function, but it will save you so much bandwidth * that it might be worth it. * * @todo complete this function and put it in the loop with some checkbox * @author Woxxy * @return boolean true if success, false if failure. */ public function optipng() { if ($this->mime != 'image/png') return false; $chapter = new Chapter($this->chapter_id); $comic = new Comic($chapter->comic_id); $rel = 'content/comics/"' . $comic->directory() . '/' . $chapter->directory() . '/' . $this->filename; $abs = realpath($rel); $output = array(); exec('optipng -o7 ' . $abs, $output); }
/** * Removes the compressed file from the disk and database * * @author Woxxy * @returns bool */ function remove() { $chapter = new Chapter(); $chapter->where('id', $this->chapter_id)->get(); $chapter->get_comic(); unlink("content/comics/" . $chapter->comic->directory() . "/" . $chapter->directory() . "/" . $this->filename); $this->delete(); }