Skip to content

Commit

Permalink
Fix dirname output on Windows. Remove some leftover in Cover2.
Browse files Browse the repository at this point in the history
  • Loading branch information
seblucas committed Mar 26, 2013
1 parent 4493e3c commit d2d3e68
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions epub.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ public function Cover2($path=false, $mime=false){
$mime = $item->attr('opf:media-type');
$this->coverpath = $item->attr('opf:href');
$this->coverpath = dirname('/'.$this->meta).'/'.$this->coverpath; // image path is relative to meta file
$this->coverpath = ltrim($this->coverpath,'\\');
$this->coverpath = ltrim($this->coverpath,'/');
}

Expand All @@ -448,18 +449,6 @@ public function Cover2($path=false, $mime=false){
}

if (!$hascover) return $this->no_cover();

$zip = new ZipArchive();
if(!@$zip->open($this->file)){
throw new Exception('Failed to read epub file');
}
$data = $zip->getFromName($this->coverpath);

return array(
'mime' => $mime,
'data' => $data,
'found' => $this->coverpath
);
}

/**
Expand Down

0 comments on commit d2d3e68

Please sign in to comment.