예제 #1
0
         unset($data);
     }
 } elseif (is_uploaded_file($_FILES['coverfile']['tmp_name'])) {
     $cover = $_FILES['coverfile']['tmp_name'];
 }
 if ($cover) {
     $info = @getimagesize($cover);
     if (preg_match('/^image\\/(gif|jpe?g|png)$/', $info['mime'])) {
         $epub->Cover($cover, $info['meta']);
     } else {
         $error = 'Not a valid image file' . $cover;
     }
 }
 // save the ebook
 try {
     $epub->save();
 } catch (Exception $e) {
     $error = $e->getMessage();
 }
 // clean up temporary cover file
 if ($cover) {
     @unlink($cover);
 }
 // rename
 $author = array_shift(array_keys($epub->Authors()));
 $title = $epub->Title();
 $new = to_file($author . '-' . $title);
 $new = $bookdir . $new . '.epub';
 $old = $epub->file();
 if (realpath($new) != realpath($old)) {
     if (!@rename($old, $new)) {