Fórum
Display custom image - liferay 6.1 GA 1
Dariusz Sawicki, modificado 12 Anos atrás.
Display custom image - liferay 6.1 GA 1
Regular Member Postagens: 165 Data de Entrada: 27/03/09 Postagens 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
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, modificado 12 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1
Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens 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, modificado 12 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1
Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens 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, modificado 12 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1
Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens 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, modificado 12 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1
Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Sorry, it was the uri issue. Need my 3 cups of coffee before I can begin thinking.
Davide Rossi, modificado 11 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1
Junior Member Postagens: 55 Data de Entrada: 03/07/10 Postagens 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
After restarting the portal I uploaded a 800px image
I then created a new WebContent structure and template
The structure code contains:
The tempate code contains:
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
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
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
dl.file.entry.thumbnail.custom1.max.height=400
dl.file.entry.thumbnail.custom1.max.width=400
dl.file.entry.thumbnail.custom2.max.height=600
dl.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:
<!--?xml version="1.0"?-->
<root>
<dynamic-element name="Image" type="document_library" index-type="" repeatable="false" />
</root>
The tempate code contains:
#set ($newImage = $Image.getData())
<a href="$newImage" target="_blank"><img alt="" src="$newImage"></a>
<a href="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=1"></a>
<a href="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=2"></a>
<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
if (imageId == dlFileEntry.getSmallImageId()) {
queryString = "&imageThumbnail=1";
}
else if (imageId == dlFileEntry.getSmallImageId()) {
queryString = "&imageThumbnail=2";
}
else if (imageId == dlFileEntry.getSmallImageId()) {
queryString = "&imageThumbnail=3";
}
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 Rossi, modificado 11 Anos atrás.
RE: Display custom image - liferay 6.1 GA 1 (SOLVED)
Junior Member Postagens: 55 Data de Entrada: 03/07/10 Postagens Recentes
Downloaded latest 6.1.x git Source
Compiled
Edited tomcat/webapps/WEB-INF/classes/portal-ext.properties
added below lines:
After starting the portal I uploaded some large images
I then created a new WebContent structure and template
The structure code contains:
The tempate code contains:
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!!!
Compiled
Edited tomcat/webapps/WEB-INF/classes/portal-ext.properties
added below lines:
dl.file.entry.thumbnail.custom1.max.height=400
dl.file.entry.thumbnail.custom1.max.width=400
dl.file.entry.thumbnail.custom2.max.height=600
dl.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:
<!--?xml version="1.0"?-->
<root>
<dynamic-element name="Image" type="document_library" index-type="" repeatable="false" />
</root>
The tempate code contains:
#set ($newImage = $Image.getData())
<a href="$newImage" target="_blank"><img alt="" src="$newImage"></a>
<a href="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=1"></a>
<a href="$newImage" target="_blank"><img alt="" src="$newImage+&imageThumbnail=2"></a>
<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!!!