Foren

Get Small Image from Blog Entry using Freemarker.

thumbnail
Claudio Donaté, geändert vor 9 Jahren.

Get Small Image from Blog Entry using Freemarker.

Junior Member Beiträge: 68 Beitrittsdatum: 09.04.15 Neueste Beiträge
Hello guys. I'm very new to Liferay and I need some help. I have a Asset Publisher on my home page and I need to display a few Blog entries with my own Display template.

The information I need to show are the same ones that show when I choose Abstract. Title, Abstract, Small Image and a link to read the full blog entry on another page.

The title, abstract and link (sort of) I know how to do it, it's just the Small Image that I can't seem to find. I know how to do it on a Article, but not on a blog entry.

Can anyone help me? If there is a simple way to make the link, I would also like to know.

Any help is appreciated.

Thanks.

I'm using Liferay 6.2 ga2 with Tomcat 7.

Cheers.
thumbnail
Claudio Donaté, geändert vor 9 Jahren.

RE: Get Small Image from Blog Entry using Freemarker.

Junior Member Beiträge: 68 Beitrittsdatum: 09.04.15 Neueste Beiträge
Anybody? Please, help.
thumbnail
Jan Geißler, geändert vor 9 Jahren.

RE: Get Small Image from Blog Entry using Freemarker.

Liferay Master Beiträge: 735 Beitrittsdatum: 05.07.11 Neueste Beiträge
Hey, maybe:

blogsEntry.getSmallImageURL()

could give you the wanted result.
Not sure about it, as i haven't tried this out, but it SHOULD work ;)
thumbnail
Sebastian Wörner, geändert vor 8 Jahren.

RE: Get Small Image from Blog Entry using Freemarker.

Junior Member Beiträge: 46 Beitrittsdatum: 18.11.14 Neueste Beiträge
In my Display Templates for the Asset Publisher, i use this code to show the thumbnails:


<#if entries?has_content>
<#list entries as entry>
...
<img src="${entry.getAssetRenderer().getThumbnailPath(renderRequest)}">
...
<!--#list-->
<!--#if-->
Matteo Gnocchi, geändert vor 7 Jahren.

RE: Get Small Image from Blog Entry using Freemarker.

Junior Member Beiträge: 29 Beitrittsdatum: 29.03.16 Neueste Beiträge
Hi!!!
I'm trying to do the same on Liferay 7 CE but I get the following error:

The following has evaluated to null or missing:
==> curEntry.getAssetRenderer().getThumbnailPath(renderRequest)

Can you help me?
Thx!!!

Sebastian Wörner:
In my Display Templates for the Asset Publisher, i use this code to show the thumbnails:


&lt;#if entries?has_content&gt;
&lt;#list entries as entry&gt;
...
<img src="${entry.getAssetRenderer().getThumbnailPath(renderRequest)}">
...
<!--#list-->
<!--#if-->
Marek Cz, geändert vor 6 Jahren.

RE: Get Small Image from Blog Entry using Freemarker.

Junior Member Beiträge: 47 Beitrittsdatum: 17.11.17 Neueste Beiträge
Hey,

in case someone still runs into this:

Matteo Gnocchi:
Hi!!!
I'm trying to do the same on Liferay 7 CE but I get the following error:

The following has evaluated to null or missing:
==> curEntry.getAssetRenderer().getThumbnailPath(renderRequest)



The problem on my end was that some articles had a thumbnail while others did not. I resolved it using the following:


&lt;#if entry.getClassName() == "com.liferay.journal.model.JournalArticle" &amp;&amp; assetRenderer.getThumbnailPath(renderRequest)??&gt;
  <p>My thumbnail image: <img src="${assetRenderer.getThumbnailPath(renderRequest)}"></p>
<!--#if-->


Hope this helps.