Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Tech Box
Dipslay image with dynamic data list using java and jsp
2. Mai 2013 06:22
Antwort

Tech Box

Rang: New Member

Nachrichten: 18

Eintrittsdatum: 5. Februar 2013

Neue Beiträge

I used WCM dynamic data list to capture both textual and image information (via Image upload control). Now it needs to develop a java program with JSP to implement the customized portlet to display back such image content. The design is typical one by outputing the image control into HTML IMG element with 'src' attribute. But my question is that how can I know where the file path of image captured within dynamic data list. Or does it any existing Liferay API service to serve for this scenario.

Please advise.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
2. Mai 2013 06:42
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Liferay Master

Nachrichten: 521

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

My first idea is check how the file is linked to the list. If it's UUID, or DLFileEntryId, etc. there should be an API to retreive it. If you check the Documents and Media portlet you will see how the URL is generated for a document/image so you can build your URL based on that pattern. I'm not sure whether there is an API to build that URL out of the box, but there's a chance but should search for it in the portal source.
Tech Box
RE: Dipslay image with dynamic data list using java and jsp
2. Mai 2013 17:41
Antwort

Tech Box

Rang: New Member

Nachrichten: 18

Eintrittsdatum: 5. Februar 2013

Neue Beiträge

Thanks of your comment. Since the image file was uploaded into dynamic data list (DDL), hence, the library of Document and Media portlet, such as DLFileEntry is not applicable. Also I try to search DDL related Java API, such as DDLRecordLocalServiceUtil, DDLRecordSetLocalServiceUtil, but all of them don't have API to convert as stream object.

Also I tried to list to ".toString" the content of DDLRecord and for the fields of capturing image, I convert the content as JSON object and found the file path

[{"name":"rss.png","path":"ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/11061/1.1/attachment","classPK":"11061","className":"com.liferay.portlet.dynamicdatalists.model.DDLRecord"}] - (file-upload).

But I still have no idea to transform the path into HTML IMG SRC attribute.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
3. Mai 2013 00:08
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Liferay Master

Nachrichten: 521

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

Hi,

I see your problem now, but I have to check it how the data is stored and can be accessed. I'm lack of free time currently, but if you can upload a sample war with minimal logic (just upload the file should be enough) I would try to check it when I have some free time.
Tech Box
RE: Dipslay image with dynamic data list using java and jsp
3. Mai 2013 09:16
Antwort

Tech Box

Rang: New Member

Nachrichten: 18

Eintrittsdatum: 5. Februar 2013

Neue Beiträge

Hi,

I found out that below JSON object with attribute "path" in which the value "ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/1.1/attachment" can transform as "http://localhost:8080/documents/ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/attachment" is the URL link of the image "rss.png" that can be viewed with internet browser.

[{"name":"rss.png","path":"ddm/com.liferay.portlet.dynamicdatalists.model.DDLRecord/1106/1.1/attachment","classPK":"11061","className":"com.liferay.portlet.dynamicdatalists.model.DDLRecord"}] - (file-upload).

But still not sure why such full URL link is wiped out the portion "1.1" from the original path as mentioned above.
Vilmos Papp
RE: Dipslay image with dynamic data list using java and jsp
3. Mai 2013 13:09
Antwort

Vilmos Papp

LIFERAY STAFF

Rang: Liferay Master

Nachrichten: 521

Eintrittsdatum: 21. Oktober 2010

Neue Beiträge

Hi,

I think the 1.1 is the version of the attachment, but if you access it without specifying the version, than you can access the latest one (at least for documents and media it works like this)