*DOWNLOAD: https://github.com/raiju/phpMobi *EXAMPLES: set("title",$titlee ); $content->set("author", $authorr); $content->appendChapterTitle("Introduction"); for($i = 0, $lenI = rand(5, 10); $i < $lenI; $i++){ $content->appendParagraph("P".($i+1)); } //Based on PHP's imagecreatetruecolor help paage $im = imagecreatetruecolor(220, 200); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 10, 5, 5, 'A Simple Text String', $text_color); imagestring($im, 5, 15, 75, 'A Simple Text String', $text_color); imagestring($im, 3, 25, 125, 'A Simple Text String', $text_color); imagestring($im, 2, 10, 155, 'A Simple Text String', $text_color); $content->appendImage($im); imagedestroy($im); $content->appendPageBreak(); for($i = 0, $lenI = rand(10, 15); $i < $lenI; $i++){ $content->appendChapterTitle(($i+1).". Chapter ".($i+1)); for($j = 0, $lenJ = rand(20, 40); $j < $lenJ; $j++){ $content->appendParagraph("P".($i+1).".".($j+1)." TEXT TEXT TEXT"); } $content->appendPageBreak(); } $mobi->setContentProvider($content); }else{ $url = "http://thetricky.net/mySQL/GROUP%20BY%20vs%20ORDER%20BY"; $recognize = false; $mobi = new MOBI(); //Create the mobi object $content = null; //Find and set the content handler if($recognize){ $content = RecognizeURL::GetContentHandler($url); } //Pass through to right handler if($content==null){ $content = new OnlineArticle($url); } //If handler not found $mobi->setContentProvider($content); } $title = $mobi->getTitle(); if($title === false) { $title = "file"; } $title = urlencode(str_replace(" ", "_", strtolower(substr($title, 0, 12)))); $mobi->save ($path_to_output.$title.".mobi"); //Save the file locally $mobi->download ($title.".mobi"); //download exit; ?> * //Then use one of the following ways to prepare information (it should be in the form of valid html) * $mobi->setInternetSource($url); //Load URL, the result will be cleaned using a Readability port * $mobi->setFileSource($file); //Load a local file without any extra changes * $mobi->setData($data); //Load data * * //If you want, you can set some optional settings (see Settings.php for all recognized settings) * $options = array( * "title"=>"Insert title here", * "author"=>"Author" * ); * $mobi->setOptions($options); * * //Then there are two ways to output it: * $mobi->save($file); //Save the file locally * $mobi->download($name); //Let the client download the file, make sure the page * //that calls it doesn't output anything,