-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
59 lines (47 loc) · 1.21 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once("functions.php");
$book_title = "test";
$infiles_folder = scandir($book_title);
$infiles = array();
foreach($infiles_folder as $infile)
{
if($infile != "." && $infile != "..")
{
$infiles[] = $infile;
}
}
$basefiles_folder = "basefiles/";
$book_uuid = create_uuid();
$epub_name = $book_title;
$extenension = ".epub";
//create all static stuff
$epub_name .= $extenension;
mkdir($epub_name);
$basefiles[] = "cover.jpeg";
$basefiles[] = "mimetype";
$basefiles[] = "page_styles.css";
$basefiles[] = "stylesheet.css";
$basefiles[] = "titlepage.xhtml";
foreach($basefiles as $basefile)
{
copy($basefiles_folder.$basefile, $epub_name."/".$basefile);
}
recurse_copy($basefiles_folder."META-INF", $epub_name."/META-INF");
//copy the images
$page_number = 1;
foreach($infiles as $infile)
{
copy($book_title."/".$infile, $epub_name."/".$page_number.".jpg");
$page_number++;
}
$pages = $page_number;
//dynamic files
$book_uuid = create_uuid();
require_once($basefiles_folder."content.opf.php");
require_once($basefiles_folder."page_n.xhtml.php");
for($i = 1;$i <= $pages;$i++)
{
write_page_xhtml($i);
}
require_once($basefiles_folder."toc.nx.php");
?>