enhanced the pdf file detection in the code file view

This commit is contained in:
hyung-hwan 2016-02-17 06:36:27 +00:00
parent 2afcb8feba
commit 664891d56b
2 changed files with 17 additions and 8 deletions

View File

@ -14,15 +14,24 @@
{ {
if ($pn == 'svn:mime-type') if ($pn == 'svn:mime-type')
{ {
if ($pv == 'application/octet-stream' && if ($pv == 'application/octet-stream')
in_array (strtolower($fileext), array ('png', 'jpg', 'gif', 'tif', 'bmp', 'ico')))
{ {
$img = @imagecreatefromstring ($file['content']); $lower_fileext = strtolower($fileext);
if ($img !== FALSE) if (in_array ($lower_fileext, array ('png', 'jpg', 'gif', 'tif', 'bmp', 'ico')))
{
$img = @imagecreatefromstring ($file['content']);
if ($img !== FALSE)
{
@imagedestroy ($img);
$is_image_file = TRUE;
$is_special_stream = TRUE;
break;
}
}
else if (in_array ($lower_fileext, array ('pdf')))
{ {
@imagedestroy ($img);
$is_image_file = TRUE;
$is_special_stream = TRUE; $is_special_stream = TRUE;
$is_pdf_file = TRUE;
break; break;
} }
} }
@ -502,7 +511,7 @@ if ($login['settings'] != NULL &&
print '<div id="code_file_pdf_navigator">'; print '<div id="code_file_pdf_navigator">';
print '<button id="code_file_pdf_first_page"><i class="fa fa-fast-backward"></i></button>'; print '<button id="code_file_pdf_first_page"><i class="fa fa-fast-backward"></i></button>';
print '<button id="code_file_pdf_prev_page"><i class="fa fa-backward"></i></button>'; print '<button id="code_file_pdf_prev_page"><i class="fa fa-backward"></i></button>';
print '<input type="range" id="code_file_pdf_page_slider"/>'; print '<input type="range" id="code_file_pdf_page_slider" step="1" />';
print '<span id="code_file_pdf_page"><span id="code_file_pdf_page_num"></span>/<span id="code_file_pdf_page_count"></span></span>'; print '<span id="code_file_pdf_page"><span id="code_file_pdf_page_num"></span>/<span id="code_file_pdf_page_count"></span></span>';
print '<button id="code_file_pdf_next_page"><i class="fa fa-forward"></i></button>'; print '<button id="code_file_pdf_next_page"><i class="fa fa-forward"></i></button>';
print '<button id="code_file_pdf_last_page"><i class="fa fa-fast-forward"></i></button>'; print '<button id="code_file_pdf_last_page"><i class="fa fa-fast-forward"></i></button>';

View File

@ -181,7 +181,7 @@ www_DATA = \
medium-editor-tables.js \ medium-editor-tables.js \
showdown.js \ showdown.js \
d3.min.js \ d3.min.js \
CodeFlower.js \ CodeFlower.js \
pdf.min.js \ pdf.min.js \
pdf.worker.min.js pdf.worker.min.js