Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
sawi _
Display custom image - liferay 6.1 GA 1
20 de Fevereiro de 2012 06:34
Resposta

sawi _

Ranking: Regular Member

Mensagens: 163

Data de entrada: 27 de Março de 2009

Mensagens recentes

Hello
I developed portlet to show custom image.
In 6.1 I try generate custom image by add to portal-ext.properties

dl.file.entry.thumbnail.custom1.max.height=100
dl.file.entry.thumbnail.custom1.max.width=100

dl.file.entry.thumbnail.custom2.max.height=300
dl.file.entry.thumbnail.custom2.max.width=300

-- also i try this
ig.image.custom1.max.dimension=200
ig.image.custom2.max.dimension=70

but on the portlet page i display image object :

{uuid=0d48571a-8bf6-4ec2-9a88-e8d485407dde, fileEntryId=10436, groupId=10180, companyId=10154, userId=10196, userName=Test Test, versionUserId=10196, versionUserName=Test Test, createDate=Mon Feb 20 14:19:32 GMT 2012, modifiedDate=Mon Feb 20 14:19:32 GMT 2012, repositoryId=10180, folderId=10433, name=1, extension=jpg, mimeType=image/jpeg, title=Chrysanthemum.jpg, description=, extraSettings=, fileEntryTypeId=0, version=1.0, size=879394, readCount=1, smallImageId=0, largeImageId=0, custom1ImageId=0, custom2ImageId=0}

and don't know why i don;t have smaill imageId and other "largeImageId=0, custom1ImageId=0, custom2ImageId"

Anybody know what I doing wrong?

Regards
Darek
Mika Koivisto
RE: Display custom image - liferay 6.1 GA 1
14 de Março de 2012 17:38
Resposta

Mika Koivisto

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1505

Data de entrada: 7 de Agosto de 2006

Mensagens recentes

Those are legacy image ids and they are no longer used. You can get custom1 thumbnail by adding &imageThumbnail=1 to the image url. Custom2 would be &imageThumbnail=2. DLUtil.getPreviewURL() will assist you in generating the url.
Hitoshi Ozawa
RE: Display custom image - liferay 6.1 GA 1
14 de Março de 2012 17:45
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7952

Data de entrada: 23 de Março de 2010

Mensagens recentes

Mika, it is possible to take these settings out from the portal.properties as well in the next release? It really confuses users and it's a very difficult uphill battle convincing users not to use them when obsolete settings are still there.
Mika Koivisto
RE: Display custom image - liferay 6.1 GA 1
14 de Março de 2012 17:59
Resposta

Mika Koivisto

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1505

Data de entrada: 7 de Agosto de 2006

Mensagens recentes

The settings aren't obsolete. At least the dl.file.entry ones. I didn't see any ig.image.xx ones in there.
Hitoshi Ozawa
RE: Display custom image - liferay 6.1 GA 1
14 de Março de 2012 18:17
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7952

Data de entrada: 23 de Março de 2010

Mensagens recentes

Sorry, it was the uri issue. Need my 3 cups of coffee before I can begin thinking. emoticon
Davide N. P. Rossi
RE: Display custom image - liferay 6.1 GA 1
14 de Maio de 2012 01:39
Resposta

Davide N. P. Rossi

Ranking: Junior Member

Mensagens: 55

Data de entrada: 3 de Julho de 2010

Mensagens recentes

Hi to all,
I have spent a while on trying to figure out how custom1 and custom2 images work with no positive result.

I added below lines to portal-ext.properties
1dl.file.entry.thumbnail.custom1.max.height=400
2dl.file.entry.thumbnail.custom1.max.width=400
3
4dl.file.entry.thumbnail.custom2.max.height=600
5dl.file.entry.thumbnail.custom2.max.width=600


After restarting the portal I uploaded a 800px image
I then created a new WebContent structure and template

The structure code contains:
1<?xml version="1.0"?>
2<root>
3    <dynamic-element name="Image" type="document_library" index-type="" repeatable="false"/>
4</root>


The tempate code contains:
1#set ($newImage = $Image.getData())
2
3<A HREF="$newImage" target="_blank"><img alt="" src="$newImage" /></A>
4<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=1" /></A>
5<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=2" /></A>
6<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=3" /></A>


After Creating a Web Content selecting the new uploaded image and previewing I get:
$newImage and $newImage+&imageThumbnail=1 are displayed
$newImage+&imageThumbnail=2 and $newImage+&imageThumbnail=3 are not displayed

Based on the following code found in: ./portal-impl/src/com/liferay/portal/webserver/WebServerServlet.java

 1if (imageId == dlFileEntry.getSmallImageId()) {
 2    queryString = "&imageThumbnail=1";
 3}
 4else if (imageId == dlFileEntry.getSmallImageId()) {
 5    queryString = "&imageThumbnail=2";
 6}
 7else if (imageId == dlFileEntry.getSmallImageId()) {
 8    queryString = "&imageThumbnail=3";
 9}


i expected to get:
original image (800px)
&imageThumbnail=1 (128px)
&imageThumbnail=2 (400px)
&imageThumbnail=3 (600px)

Seems to me that the custom images are not created. Looking through data directory there are only the original image and default thumbnail.

Am I doing something wrong??? Can it be a bug not creating the custom images when uploading??? Please help!

Thanks
Davide N. P. Rossi
RE: Display custom image - liferay 6.1 GA 1 (SOLVED)
16 de Maio de 2012 03:25
Resposta

Davide N. P. Rossi

Ranking: Junior Member

Mensagens: 55

Data de entrada: 3 de Julho de 2010

Mensagens recentes

Downloaded latest 6.1.x git Source
Compiled
Edited tomcat/webapps/WEB-INF/classes/portal-ext.properties
added below lines:
1dl.file.entry.thumbnail.custom1.max.height=400
2dl.file.entry.thumbnail.custom1.max.width=400
3dl.file.entry.thumbnail.custom2.max.height=600
4dl.file.entry.thumbnail.custom2.max.width=600


After starting the portal I uploaded some large images
I then created a new WebContent structure and template

The structure code contains:
1<?xml version="1.0"?>
2<root>
3    <dynamic-element name="Image" type="document_library" index-type="" repeatable="false"/>
4</root>



The tempate code contains:
1#set ($newImage = $Image.getData())
2
3<A HREF="$newImage" target="_blank"><img alt="" src="$newImage" /></A>
4<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=1" /></A>
5<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=2" /></A>
6<A HREF="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=3" /></A>


After Creating a Web Content selecting the new uploaded image and previewing I get:
ALL FOUR CORRECTLY RESIZED IMAGES

It will work in 6.1.1 GA2

Great Work!!!! Thanks!!!