Software Workshop

라이브러리

다음의 epubjs-reader 라이브러리를 이용
https://github.com/futurepress/epubjs-reader

구축 방법

git을 이용하여 다운로드

git clone https://github.com/futurepress/epubjs-reader

epub.js.example 디렉토리를 epub 뷰어의 디렉토리로 정함

mkdir epub.js.test

epubjs-reader/reader 경로 이하의 폴더를 epub.js.test 디렉토리에 복사

cp -r epubjs-reader/reader/* epub.js.test/

페이지의 HTML 소스 복사

index.html을 index.php로 복사

cd epub.js.test
mv index.html index.php

index.php를 편집하여 페이지 최상단에 다음 코드를 추가

$filename = $_GET['filename'];

다음 코드의 파라미터를 moby-dick 대신에 위에서 선언한 $filename으로 대체

window.reader = ePubReader("https://s3.amazonaws.com/moby-dic/", { restore: true });
window.reader = ePubReader("=$filename?", { restore: true });

EPUB 파일은 같은 디렉토리에 위치시켜야 하며, 별도의 디렉토리에 모아두려면 현재 디렉토리를 기준으로 하위에 위치시키고 상대경로로 기술하면 됨

github에서 받은 파일 삭제

cd ..
rm -rf epub.js

접근 경로

ex) http://terzeron.com/epub.js.test/index.php?filename=moby-dick.epub

소스코드 저장소

https://github.com/terzeron/EPUBjsTest