MOBIFile::set PHP Method

set() public method

Change the file's settings. For example set("author", "John Doe") or set("title", "The adventures of John Doe").
public set ( $key, $value )
$key Key of the setting to insert.
    public function set($key, $value)
    {
        $this->settings[$key] = $value;
    }

Usage Example

Beispiel #1
0
     }
     $mobi->setContentProvider($content);
     //Get title and make it a 12 character long filename
     $title = $mobi->getTitle();
     if ($title === false) {
         $title = 'file';
     }
     $title = urlencode(str_replace(' ', '_', strtolower(substr($title, 0, 12))));
     //Send the mobi file as download
     $mobi->download($title . '.mobi');
     die;
 } else {
     //Create the mobi object
     $mobi = new MOBI();
     $content = new MOBIFile();
     $content->set('title', 'My first eBook');
     $content->set('author', 'Me');
     $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();
All Usage Examples Of MOBIFile::set