留言板

How to show thumbnail image of a document & media object

Ying Wang,修改在8 年前。

How to show thumbnail image of a document & media object

Junior Member 帖子: 36 加入日期: 14-5-16 最近的帖子
I am now using liferay 6.2. I created a webcontent for file download. There is a structure and template has been defined for it. From my pasted code, you can see, I have created download link, and it also can be downloaded. But I want to show an thumbnail image. I am not sure whether I can get this image by the "$Documents_and_Media1613" object? Or should I invoke some image service to do that?

Usually when we upload a file into documents and media library, it always show us an image(Please see my attachment). I just want the image shows like this.


<div class="marketing2-download">
<div class="span3">
<img src="$Documents_and_Media1613.getData()" />

</div>
<div class="span9">
<h4>$reserved-article-title.getData()</h4>
<p>$Description.getData()</p>
<div>
<span class="download-item-name span8">

</span>
<span class="span4">
<a href="$Documents_and_Media1613.getData()">
<img class="marketing2-download-img" src="$request.theme-display.path-theme-images/LIST_down.icon.png">
</a>
</span>
</div>
</div>
</div>
thumbnail
Meera Prince,修改在8 年前。

RE: How to show thumbnail image of a document & media object

Liferay Legend 帖子: 1111 加入日期: 11-2-8 最近的帖子
Hi
The image is available in the following path /images/file_system/large/document.png of every theme.
When we create new theme also we will inherited all files from classic theme so this image available in every theme.
So you need to get theme images path and append above path
<img class="marketing2-download-img" src="$request.theme-display.path-theme-images/file_system/large/document.png">

it may help you..

Regards,
Meera Prince
Ying Wang,修改在8 年前。

RE: How to show thumbnail image of a document & media object

Junior Member 帖子: 36 加入日期: 14-5-16 最近的帖子
Meera Prince:
Hi
The image is available in the following path /images/file_system/large/document.png of every theme.
When we create new theme also we will inherited all files from classic theme so this image available in every theme.
So you need to get theme images path and append above path
<img class="marketing2-download-img" src="$request.theme-display.path-theme-images/file_system/large/document.png">

it may help you..

Regards,
Meera Prince


Hi Prince,
Thanks for your reply. But 'document.png' is hard coding. I suppose the image should be different for various kinds of document type. For example, jpg, word, or some others. Just like what we are seeing in the "Documents & Media", there are lots of thunbnail images. Is there an api that I can invoke to get document's thumbnail image. So that I could just invoke it in the vm
thumbnail
Juan Gonzalez,修改在8 年前。

RE: How to show thumbnail image of a document & media object

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi Ying,

I think DLUtil.getThumbnailSrc is what you're looking for (code from 6.2.3 GA4):

https://github.com/liferay/liferay-portal/blob/6.2.3-ga4/portal-impl/src/com/liferay/portlet/documentlibrary/util/DLImpl.java#L932-L951

Hope it helps.