You are here

function epub_file_update in Epub 7

Same name and namespace in other branches
  1. 8 epub.module \epub_file_update()

File

./epub.module, line 129

Code

function epub_file_update($file) {
  $destination = 'public://epub_content/' . $file->fid;

  /*
    switch ($file->filemime) {
    case 'application/x-ibooks+zip':
      file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
      return epub_unzip(drupal_realpath($file->uri), $destination);
    case 'application/epub+zip':
      file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
      return epub_unzip(drupal_realpath($file->uri), $destination);
    }
  */
  $tmp = explode('.', $file->filename);
  $file_extension = end($tmp);
  switch ($file_extension) {
    case 'epub':
      file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
      return epub_unzip(drupal_realpath($file->uri), $destination);
    case 'ibooks':
      file_prepare_directory($destination, FILE_CREATE_DIRECTORY);
      return epub_unzip(drupal_realpath($file->uri), $destination);
  }
}