Forums de discussion

uploaded image width and height set

Ranjit Sahu, modifié il y a 9 années.

uploaded image width and height set

New Member Publications: 10 Date d'inscription: 16/04/14 Publications récentes
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, modifié il y a 9 années.

RE: uploaded image width and height set

New Member Publications: 10 Date d'inscription: 16/04/14 Publications récentes
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
thumbnail
Krzysztof Golebiowski, modifié il y a 9 années.

RE: uploaded image width and height set

Liferay Master Publications: 549 Date d'inscription: 25/06/11 Publications récentes
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, modifié il y a 9 années.

RE: uploaded image width and height set

New Member Publications: 10 Date d'inscription: 16/04/14 Publications récentes
Hi Krzysztof,
Thanks for your information.I will try this.
Oliver Bayer, modifié il y a 9 années.

RE: uploaded image width and height set

Liferay Master Publications: 894 Date d'inscription: 18/02/09 Publications récentes
Hi Ranjit,

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

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
thumbnail
Krzysztof Golebiowski, modifié il y a 9 années.

RE: uploaded image width and height set

Liferay Master Publications: 549 Date d'inscription: 25/06/11 Publications récentes
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, modifié il y a 9 années.

RE: uploaded image width and height set

Liferay Master Publications: 894 Date d'inscription: 18/02/09 Publications récentes
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, modifié il y a 9 années.

RE: uploaded image width and height set

New Member Publications: 10 Date d'inscription: 16/04/14 Publications récentes
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
thumbnail
bhargavi m, modifié il y a 9 années.

RE: uploaded image width and height set

Junior Member Publications: 47 Date d'inscription: 05/04/12 Publications récentes
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.