Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ketan Patel
Change Portlet Background
May 14, 2012 1:56 AM
Answer

Ketan Patel

Rank: Junior Member

Posts: 72

Join Date: May 4, 2012

Recent Posts

Hi!

I want change the background image of specific portlet, How can I do that?
I also want to change the background position of Image.

I would appreciate any help.

Thanks,
Ketan Patel.
Ajeykumar Hulivana Boregowda
RE: Change Portlet Background
May 14, 2012 5:27 AM
Answer

Ajeykumar Hulivana Boregowda

Rank: Junior Member

Posts: 72

Join Date: March 12, 2012

Recent Posts

Hi patel We can do it by following steps (in CE6.1)

1. In UI goto options of that particular portlet
2. select look and feel
3. select advanced styling
4. In that click on "Add a CSS rule for just this portlet"
5. add following code "background-image:url("/images/sampleimage.jpg");"
6.here you have to paste the sampleimage.jpg in folder by name images which is the folder you have to create inside webapps folder of server.
Priyanka Dhingra
RE: Change Portlet Background
May 14, 2012 11:21 PM
Answer

Priyanka Dhingra

Rank: Liferay Master

Posts: 501

Join Date: December 19, 2011

Recent Posts

Hi Ketan,

You can try this also
http://www.liferay.com/community/forums/-/message_boards/message/13189540
Ketan Patel
RE: Change Portlet Background
May 15, 2012 5:20 AM
Answer

Ketan Patel

Rank: Junior Member

Posts: 72

Join Date: May 4, 2012

Recent Posts

Thanks Ajay for quick reply!

In my case background image would be added by admin of the portlet.
so my first concern is where I have to store that selected image? In database or any where else? if in database than in which table?

Thanks,
Ketan
Hitoshi Ozawa
RE: Change Portlet Background
May 15, 2012 5:35 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Just upload your image to Document and Media library and use the url of the uploaded file.
Ketan Patel
RE: Change Portlet Background
May 15, 2012 5:45 AM
Answer

Ketan Patel

Rank: Junior Member

Posts: 72

Join Date: May 4, 2012

Recent Posts

Thanks Priyanka!

In my case admin will add/choose image through browse [uploader/file chooser]. so, I have created one hook for that. and admin will upload the image and applied it.
so, you have any better idea for the same.

Thanks,
Ketan Patel
Hitoshi Ozawa
RE: Change Portlet Background
May 15, 2012 6:02 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

I have created one hook for that. and admin will upload the image and applied it.


Why not just use the Document and Media portlet? There's no need to create a plugin. Liferay already supports this feature.
Ketan Patel
RE: Change Portlet Background
May 15, 2012 11:56 PM
Answer

Ketan Patel

Rank: Junior Member

Posts: 72

Join Date: May 4, 2012

Recent Posts

Hi Hitoshi!

Thanks for reply.
As per customer requirements, I have to upload image from my custom hook. so, Is there any better solution for uploading image and save it to database and display it to on portlet?

Thanks,
Ketan Patel
Hitoshi Ozawa
RE: Change Portlet Background
May 16, 2012 3:52 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

You're mixing different questions in one thread and it is very confusing and discouraged in forum policy. Please create a new thread for file upload question. You're question is also confusing. If you are required to create a hook and you've created it already, what is your question? You haven't specified how your hook is uploading images and saving it to a database, how are we to know whether there is a "better way" when you haven't told us what you've done. Anyways, please create a new thread on this issue because it's not related to your first question on changing portlet's background.
Ketan Patel
RE: Change Portlet Background
May 16, 2012 4:23 AM
Answer

Ketan Patel

Rank: Junior Member

Posts: 72

Join Date: May 4, 2012

Recent Posts

Hi Hitoshi!

Sorry if you are not getting my question correctly.
Let me clear my question from scratch.

I have created one hook and the jsp file for my hook is under
/html/portlet/portlet_css/view.jsp
. I have added file upload tag under
<aui:fieldset id="background-styles">
tag in view.jsp file.

now, my concerns is that, How I will save the Image in database? and in which table? please check the view.jsp file and please help me!

FYI my view.jsp page code:

 1<aui:fieldset id="background-styles">
 2                    <aui:layout>
 3                        <aui:column columnWidth="30" first="<%=true%>">
 4                            <aui:input label="background-color" name="lfr-bg-color" />
 5                        </aui:column>
 6                        <aui:column columnWidth="40" second="<%=true%>">
 7                            <aui:input label="background-image" type="file" size="30" name="lfr-bg-color" />
 8                        </aui:column>
 9                        <aui:column columnWidth="30" last="<%=true%>">
10                            <aui:input label="background-repeat" name="lfr-bg-color" />
11                        </aui:column>
12                    </aui:layout>
13                </aui:fieldset>


Thanks,
Ketan