MOBI::save PHP Méthode

save() public méthode

Save the file locally
public save ( string $filename )
$filename string Path to save the file
    public function save($filename)
    {
        $prc = $this->preparePRC();
        $prc->save($filename);
    }

Usage Example

Exemple #1
0
     $mobiContent->appendChapterTitle($story["title"]);
     $mobiContent->appendParagraph("by: " . $story["author"]);
     $mobiContent->appendPageBreak();
     for ($i = 0; $i < $numChapter; $i++) {
         $title = isset($story["chapters"]["title"][$i]) ? $story["chapters"]["title"][$i] : "";
         $content = isset($story["chapters"]["content"][$i]) ? $story["chapters"]["content"][$i] : "";
         if (!empty($content) && !empty($title)) {
             $title = formatTitle($title, $i);
             $mobiContent->appendChapterTitle($title);
             $mobiContent->appendParagraph($content);
             $mobiContent->appendPageBreak();
         }
     }
     $mobi->setContentProvider($mobiContent);
     $filename = $uniqid . "_" . $story["title"] . " - " . $story["author"] . ".mobi";
     $mobi->save("./tmp/" . $filename);
     if (!empty($email)) {
         mailAttachment($filename, "./tmp/", $email, $uniqid);
     }
 } else {
     if ($format == "txt") {
         include_once "include/html2text.php";
         $output = $story["title"] . "\r\n\r\nby " . $story["author"] . "\r\n\r\n\r\n";
         for ($i = 0; $i < $numChapter; $i++) {
             $title = isset($story["chapters"]["title"][$i]) ? $story["chapters"]["title"][$i] : "";
             $content = isset($story["chapters"]["content"][$i]) ? $story["chapters"]["content"][$i] : "";
             if (!empty($content) && !empty($title)) {
                 $title = formatTitle($title, $i);
                 $content = convert_html_to_text($content);
                 $output .= $title . "\r\n\r\n" . $content . "\r\n\r\n";
             }
All Usage Examples Of MOBI::save