Beispiel #1
0
	/**
	 * 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);
	}