Foren
Velocity - ImageToolUtility
Bünyamin Sever, geändert vor 8 Jahren.
Velocity - ImageToolUtility
New Member Beiträge: 14 Beitrittsdatum: 22.04.15 Neueste Beiträge
Hi,
i need the width of an image,
for this i try following code...but at the end i get "null"
( i tried the same code in a portlet, there everything works fine )
How can i solve this problem? Or exists another possibility to get the width of an image ?
Thanks!
i need the width of an image,
for this i try following code...but at the end i get "null"
( i tried the same code in a portlet, there everything works fine )
<img alt="image" src="$ig.getData()">
#set ($dlAppLocalService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLAppLocalService"))
#set ($imageToolUtil = $serviceLocator.findService("com.liferay.portal.kernel.image.ImageToolUtil"))
ImageToolUtility: $imageToolUtil ## not null
#set ($tmpLabel = $ig.getData())
#set ($tmpLink = $tmpLabel.split('/'))
#set ($tmpLinkUuid = $tmpLink.get(5).split('\?'))
#set ($tmpImageGroupId = $getterUtil.getLong($tmpLink.get(2)))
#set ($tmpImageFolderId = $getterUtil.getLong($tmpLink.get(3)))
#set ($tmpImageFileName = $tmpLink.get(4))
#set ($tmpImageUuid = $tmpLinkUuid.get(0))
#set ($tmpFile = $dlAppLocalService.getFileEntryByUuidAndGroupId($tmpImageUuid, $tmpImageGroupId))
Dokument: $tmpFile ## not null, get the correct file
#set ($tmpFileVersion = $tmpFile.getFileVersion())
Version: $tmpFileVersion ## not null
#set ($tmpVersionContent = $tmpFileVersion.getContentStream(false))
Content: $tmpVersionContent ## not null
#set ($tmpImage = $imageToolUtil.getImage($tmpVersionContent))
Image: $tmpImage ## null
How can i solve this problem? Or exists another possibility to get the width of an image ?
Thanks!
Vishal Kumar, geändert vor 8 Jahren.
RE: Velocity - ImageToolUtility
Regular Member Beiträge: 198 Beitrittsdatum: 12.12.12 Neueste Beiträge
What error you are getting. Did you change portal-ext.properties?
Bünyamin Sever, geändert vor 8 Jahren.
RE: Velocity - ImageToolUtility
New Member Beiträge: 14 Beitrittsdatum: 22.04.15 Neueste Beiträge
I didn't get an error.
ImageToolUtility delegates to wrong methods... the correct method getImage() won't be called...
ImageToolUtility delegates to wrong methods... the correct method getImage() won't be called...