Forums

Home » Liferay Social Office

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ranjit Sahu
uploaded image width and height set
May 6, 2014 5:44 AM
Answer

Ranjit Sahu

Rank: New Member

Posts: 8

Join Date: April 15, 2014

Recent Posts

In my liferay application,I am uploading images?But the image height and width is very large.I want to reduce the height and width.Can anyone tell me how to set the image height and width of the uploaded image in liferay?

Thanks,
Ranjit
Ranjit Sahu
RE: uploaded image width and height set
May 6, 2014 6:16 AM
Answer

Ranjit Sahu

Rank: New Member

Posts: 8

Join Date: April 15, 2014

Recent Posts

it is posiible with following code.
<img alt="Uploaded Image" src="<%=imageRequest%>"
style="height: 70%; width: 70%;" />
But my requirement is resize the image according to the screen.I want it should dynamically change.If the screen is large, it should be large and If the screen is small, it should be small.

Thanks,
Ranjit
Krzysztof Gołębiowski
RE: uploaded image width and height set
May 7, 2014 1:27 PM
Answer

Krzysztof Gołębiowski

Rank: Liferay Master

Posts: 508

Join Date: June 25, 2011

Recent Posts

Hello Ranjit,
This is a custom functionality and you have to implement it on your own. I suppose you should resize every uploaded photo and save two images (big and small one). I don't know where do you need this, in Document Library or WebContent, but generally you implement this kind of functionality in service hooks or model listeners.

In Liferay, you can resize images with one of ImageToolUtil.scale(...) methods.

Regards,
KG
Ranjit Sahu
RE: uploaded image width and height set
May 8, 2014 4:04 AM
Answer

Ranjit Sahu

Rank: New Member

Posts: 8

Join Date: April 15, 2014

Recent Posts

Hi Krzysztof,
Thanks for your information.I will try this.
Oliver Bayer
RE: uploaded image width and height set
May 8, 2014 5:41 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 883

Join Date: February 18, 2009

Recent Posts

Hi Ranjit,

this feature is implemented ootb and can be configured using the following properties:
1dl.file.entry.thumbnail.custom1.max.height=0
2dl.file.entry.thumbnail.custom1.max.width=230
3dl.file.entry.thumbnail.custom2.max.height=0
4dl.file.entry.thumbnail.custom2.max.width=500
5...

You don't need to code it as a custom solution. You only need to customize some code if you need more different sizes for automatic thumbnail creation as defined by Liferay.

HTH Oli
Krzysztof Gołębiowski
RE: uploaded image width and height set
May 8, 2014 6:05 AM
Answer

Krzysztof Gołębiowski

Rank: Liferay Master

Posts: 508

Join Date: June 25, 2011

Recent Posts

Hmm, Olivier, you are right. There was such a functionality, I completely forgot about it. I used that once and I remember there were some problems that forced me to use ImageUtil once, but that was long time ago (in 6.0 I suppose). Thanks for correction.
Oliver Bayer
RE: uploaded image width and height set
May 8, 2014 6:29 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 883

Join Date: February 18, 2009

Recent Posts

Hi Krzysztof,

no problem emoticon. I once had to extend the original Liferay class to be able to assign more thumbnail sizes as the two (if I remember right) predefined by Liferay. Other than that it's a useful ootb feature emoticon.

Regards Oli
Ranjit Sahu
RE: uploaded image width and height set
May 9, 2014 4:48 AM
Answer

Ranjit Sahu

Rank: New Member

Posts: 8

Join Date: April 15, 2014

Recent Posts

Hi Oliver,
I have created a website in liferay.My home page is like facebook wall.Here I am showing the posts updated by friends.

My requirement is that i want to see this home page in mobile.In mobile, if the screen is large, the posts(specially images) should come down.There should not be any scroll bar to view this.

Thanks,
Ranjit
bhargavi m
RE: uploaded image width and height set
May 9, 2014 6:02 AM
Answer

bhargavi m

Rank: Junior Member

Posts: 43

Join Date: April 5, 2012

Recent Posts

one html is sufficient but we need to use 2 different css for them by using @media Queries.

go through the fallowing links which might help you out
http://cssmediaqueries.com/
http://www.w3schools.com/css/css_mediatypes.asp
http://www.w3.org/TR/css3-mediaqueries/

if you are using 6.2 EE edition with bootstrap 2.3.
Liferay provides a plugin for this which is already included in Liferay 6.2 https://www.liferay.com/marketplace/-/mp/application/35419014
you can use device recognition provider app by downloading it from marketplace. But, by doing so you will be restricted to the options provided in that app.
alternatively, you can do the detection by your own. see this link..
https://www.liferay.com/web/milen.dyankov/blog/-/blogs/mobile-device-recognition-beyond-the-ui

so you can explore all the WURFL capabilities.