Add thumbnail feature

See #589
This commit is contained in:
Matsutani Kenji 2016-07-28 06:52:33 +09:00 committed by Shinsuke Sugaya
parent 1f58ebfdda
commit efd2cc48a3
5 changed files with 88 additions and 3 deletions

View file

@ -0,0 +1,14 @@
#!/bin/sh
CMD_TYPE=$1
URL=$2
OUTPUT_FILE=$3
if [ x"$CMD_TYPE" = "xmsoffice" ] ; then
TARGET_FILE=`echo $URL | sed -e "s#^file:/*#/#g"`
TMP_FILE=/tmp/thumbnail.$$.pdf
unoconv -o $TMP_FILE -f pdf $TARGET_FILE
convert -thumbnail 200x150! $TMP_FILE $OUTPUT_FILE
rm $TMP_FILE
else
echo "Unsupported type: $CMD_TYPE"
exit 1
fi

View file

@ -6,6 +6,11 @@
<postConstruct name="add">
<arg>htmlThumbnailGenerator</arg>
</postConstruct>
<!--
<postConstruct name="add">
<arg>msofficeThumbnailGenerator</arg>
</postConstruct>
-->
</component>
<component name="htmlThumbnailGenerator" class="org.codelibs.fess.thumbnail.impl.WebDriverGenerator">
<property name="webDriverCapabilities">
@ -39,5 +44,57 @@
</postConstruct>
</component>
-->
<!--
<component name="msofficeThumbnailGenerator" class="org.codelibs.fess.thumbnail.impl.CommandGenerator">
<property name="commandList">
["bash",
"/usr/share/fess/bin/generate-thumbnail",
"msoffice",
"${url}",
"${outputFile}"]
</property>
<property name="generatorList">
["/usr/share/fess/bin/generate-thumbnail"]
</property>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"text/html"</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/vnd.openxmlformats-officedocument.presentationml.presentation"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/msword"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/vnd.ms-excel"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/vnd.ms-powerpoint"
</arg>
</postConstruct>
<postConstruct name="addCondition">
<arg>"mimetype"</arg>
<arg>"application/rtf"
</arg>
</postConstruct>
</component>
-->
</components>

View file

@ -27,11 +27,21 @@
<ol>
<c:forEach var="doc" varStatus="s" items="${documentItems}">
<li id="result${s.index}">
<h3 class="title ellipsis">
<c:if test="${thumbnailSupport}">
<div class="col-md-3 thumbnailBox">
<a class="link" href="${doc.url_link}" data-uri="${doc.url_link}"
data-id="${doc.doc_id}" data-order="${s.index}">
<img
src="${f:url('/thumbnail/')}?docId=${f:u(doc.doc_id)}&queryId=${f:u(queryId)}"
class="img-responsive thumbnail">
</a>
</div>
</c:if>
<h3 class="col-md-9 title ellipsis">
<a class="link" href="${doc.url_link}" data-uri="${doc.url_link}"
data-id="${doc.doc_id}" data-order="${s.index}">${f:h(doc.content_title)}</a>
</h3>
<div class="body">
<div class="col-md-9 body">
<div class="description">${doc.content_description}</div>
<div class="site ellipsis">
<cite>${f:h(doc.site_path)}</cite>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -196,4 +196,8 @@ $(function() {
searchForm : $('#searchForm')
});
$('img.thumbnail', $result).error(function() {
$(this).attr("src", contextPath + "/images/noimage.png");
});
});