<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Getting web content image in Liferay 7.2.1 DXP</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119614326" />
  <subtitle>Getting web content image in Liferay 7.2.1 DXP</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119614326</id>
  <updated>2026-04-05T15:39:43Z</updated>
  <dc:date>2026-04-05T15:39:43Z</dc:date>
  <entry>
    <title>RE: Getting web content image in Liferay 7.2.1 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119617005" />
    <author>
      <name>Krzysztof Gołębiowski</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119617005</id>
    <updated>2020-07-21T10:33:22Z</updated>
    <published>2020-07-21T10:33:22Z</published>
    <summary type="html">Ah, I completely forgot about that article. Then it&amp;#39;s much better to follow Pavel&amp;#39;s advice as he&amp;#39;s a Liferay employee and he actually worked on that matter.</summary>
    <dc:creator>Krzysztof Gołębiowski</dc:creator>
    <dc:date>2020-07-21T10:33:22Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting web content image in Liferay 7.2.1 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119617851" />
    <author>
      <name>Rafał Pydyniak</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119617851</id>
    <updated>2020-07-21T09:04:17Z</updated>
    <published>2020-07-21T09:04:17Z</published>
    <summary type="html">Hello,&lt;br /&gt;haha yes, Liferay is not that popular in Poland but I can see it gets some popularity recently (I myself use it for almost four years now).&lt;br /&gt;Thank you for the answer. I just found a blog article there &lt;a href="https://liferay.dev/blogs/-/blogs/oh-no-my-urls-disappeared-and-how-to-get-them-back-"&gt;https://liferay.dev/blogs/-/blogs/oh-no-my-urls-disappeared-and-how-to-get-them-back-&lt;/a&gt; (even with your comments inside with which I totally agree!) and just came back to this thread to post this as an answer&lt;br /&gt;Thank you anyway</summary>
    <dc:creator>Rafał Pydyniak</dc:creator>
    <dc:date>2020-07-21T09:04:17Z</dc:date>
  </entry>
  <entry>
    <title>RE: Getting web content image in Liferay 7.2.1 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119616301" />
    <author>
      <name>Krzysztof Gołębiowski</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119616301</id>
    <updated>2020-07-21T08:04:10Z</updated>
    <published>2020-07-21T08:04:10Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi Rafał,First of all, it's good to see a new Liferay face from Poland &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif"&gt;&lt;br&gt;&lt;br&gt;They changed the way of storing document data in Web Contents&amp;nbsp;at some point, I think now it's actually better because it gives you more data about stored file right in the template context. I retrieved the image from Web Content&amp;nbsp;in one of the FTL templates in the following way:&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;amp;lt;#assign JSONFactoryUtil = staticUtil["com.liferay.portal.kernel.json.JSONFactoryUtil"] /&amp;amp;gt;
&amp;amp;lt;#assign DLAppLocalServiceUtil = staticUtil["com.liferay.document.library.kernel.service.DLAppLocalServiceUtil"]&amp;amp;gt;
&amp;amp;lt;#assign DLUtil = staticUtil["com.liferay.document.library.kernel.util.DLUtil"] /&amp;amp;gt;

...

&amp;amp;lt;#assign jsonDlFileEntryAsString = docXml.valueOf("//dynamic-element[@name='library_document']/dynamic-content/text()") /&amp;amp;gt;
&amp;amp;lt;#assign jsonDlFileEntry = JSONFactoryUtil.createJSONObject(jsonDlFileEntryAsString) /&amp;amp;gt;
&amp;amp;lt;#assign fileEntry = DLAppLocalServiceUtil.getFileEntryByUuidAndGroupId(
&amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; jsonDlFileEntry.getString("uuid"),
&amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; jsonDlFileEntry.getString("groupId")?number) &amp;amp;gt;

&amp;amp;lt;#assign viewURL = DLUtil.getDownloadURL(fileEntry, fileEntry.getLatestFileVersion(true), themeDisplay, "") /&amp;amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;It is easily translatable to java, as it does not use any freemarker-specific features, only regular Java stuff. All the URL generation magic happens in &lt;em&gt;getDownloadURL&lt;/em&gt; method.&lt;br&gt;&lt;br&gt;KG&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Krzysztof Gołębiowski</dc:creator>
    <dc:date>2020-07-21T08:04:10Z</dc:date>
  </entry>
  <entry>
    <title>Getting web content image in Liferay 7.2.1 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119614325" />
    <author>
      <name>Rafał Pydyniak</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119614325</id>
    <updated>2020-07-20T19:37:20Z</updated>
    <published>2020-07-20T19:37:20Z</published>
    <summary type="html">Hello,&lt;br /&gt;I have an issue after migrating part of my project to Liferay 7.2.1 DXP from 7.0.6. Basically we used to get the web content image path using following code (more or less)&lt;img alt="emoticon" src="@theme_images_path@/emoticons/smile.gif" &gt;ocument myDocument = SAXReaderUtil.read(article.getContentByLocale(locale.toString()));&lt;br /&gt;Node imageField = NodeContent.getSingleNode(document, &amp;#34;Image&amp;#34;);&lt;br /&gt;NodeContent.getStringContentValue(imageField)&lt;br /&gt;&lt;br /&gt;And it worked fine but unfortunately it doesn&amp;#39;t in 7.2.1 DXP. After trying to figure out what&amp;#39;s going on I found that the XML looks different for images in web contents in Liferay 7 and Liferay 7.2.&lt;br /&gt;Basically in Liferay 7 I have something like:&lt;blockquote&gt;        &amp;lt;dynamic-content language-id=&amp;#34;en_US&amp;#34; alt=&amp;#34;&amp;#34; name=&amp;#34;XXX.png&amp;#34; title=&amp;#34;XXX.png&amp;#34; type=&amp;#34;document&amp;#34; [url=http://fileEntryId=&amp;#34;12345&amp;#34;&amp;gt;&amp;lt;![CDATA[/documents/111/222/XXX.png/QQQQQQ-WWWW-EEEE-CCCC-DDDDDDD?t=1588696601862]]&amp;gt;&amp;lt;/dynamic-content&amp;gt;&lt;/blockquote&gt;And in Liferay 7.2.1 I have:&lt;br /&gt;&lt;blockquote&gt;        &amp;lt;dynamic-content [url=http://language-id=&amp;#34;en_US&amp;#34;&amp;gt;&amp;lt;![CDATA[{&amp;#34;groupId&amp;#34;:&amp;#34;126435&amp;#34;,&amp;#34;alt&amp;#34;:&amp;#34;&amp;#34;,&amp;#34;name&amp;#34;:&amp;#34;XXX.png&amp;#34;,&amp;#34;title&amp;#34;:&amp;#34;XXX.png&amp;#34;,&amp;#34;type&amp;#34;:&amp;#34;journal&amp;#34;,&amp;#34;uuid&amp;#34;:&amp;#34;QQQQ-WWW-EEE-CCC-ec48068bbf39&amp;#34;,&amp;#34;fileEntryId&amp;#34;:&amp;#34;716022&amp;#34;,&amp;#34;resourcePrimKey&amp;#34;:&amp;#34;716460&amp;#34;}]]&amp;gt;&amp;lt;/dynamic-content&amp;gt;&lt;/blockquote&gt;So before the image source was there and that&amp;#39;s why my code worked. Now instead of the source I have JSON with informations about the image.&lt;br /&gt;I guess it might have changed because of the adaptive images but anyway I&amp;#39;d like to know how can I get the image source from the code? I guess I could parse the JSON and fetch the image based on the informations there but is there any better way? Parsing JSON String to get values for getting image path seems a little bit complicated comparing to an old way&lt;br /&gt;Best regards</summary>
    <dc:creator>Rafał Pydyniak</dc:creator>
    <dc:date>2020-07-20T19:37:20Z</dc:date>
  </entry>
</feed>
