Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Apoorva Prakash
Image is not getting displayed in web content
November 14, 2011 1:51 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Hello All,
I'm using LR6.05.
I'm getting problem in web content using a template. Image is not getting displayed.
But when I'm opening for preview or display, the image is not coming.
I've tried without template too. Same thing is happening.
When I tried to debug it through FireBug, it gives the following URI
1/image/journal/article?img_id=26172&t=1320151467035

I've checked the journalArticleImage table, the imageId is valid... But I was unable to find this struts path in struts-config.xml.
Please reveal some solution.
Thanks and Regards.
Maximilian Butterer
RE: Image is not getting displayed in web content
November 14, 2011 2:06 AM
Answer

Maximilian Butterer

Rank: Junior Member

Posts: 31

Join Date: May 14, 2010

Recent Posts

hi,
by using the follwing HTML tag (in VM Skript), the image/document from document library is displayed properly
1<img src="$imageURL" />

in my structure there is a field called "imageURL" (type: Documents and Media) on top level of the structure.
Cheers
Apoorva Prakash
RE: Image is not getting displayed in web content
November 14, 2011 2:08 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Hello Ma Bu,
Thanks for your reply..
Can you please tell me, what is the value of $imageURL on the page.
Thanks and Regards.
Apoorva Prakash
Sagar A Vyas
RE: Image is not getting displayed in web content
November 14, 2011 10:28 AM
Answer

Sagar A Vyas

Rank: Liferay Master

Posts: 655

Join Date: April 17, 2009

Recent Posts

Apoorva Prakash:
Hello All,
I'm using LR6.05.
I'm getting problem in web content using a template. Image is not getting displayed.
But when I'm opening for preview or display, the image is not coming.
I've tried without template too. Same thing is happening.
When I tried to debug it through FireBug, it gives the following URI
1/image/journal/article?img_id=26172&t=1320151467035

I've checked the journalArticleImage table, the imageId is valid... But I was unable to find this struts path in struts-config.xml.
Please reveal some solution.
Thanks and Regards.


Hi Apoorva,

Two way of displaying image either put it on Structure and access it from template as below

<img height=50px; width=48px; src="$field.DocumentImage.data" />


Here field is name of image field set by you in structure.

or if you wish to access some image from theme then you can get path like below.

#set ($imagePath = $request.get("theme-display").path-theme-images)


Here imagePath will return path upto images folder of theme.

Hope this help emoticon

Thanks,
Sagar Vyas
Apoorva Prakash
RE: Image is not getting displayed in web content
November 15, 2011 9:46 PM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Thanks Ma Bu and Sagar...
It was some other issue, relate with tomcat structuring.

Regards,
Apoorva Prakash
Narendra Dodiya
RE: Image is not getting displayed in web content
March 11, 2013 11:13 PM
Answer

Narendra Dodiya

Rank: New Member

Posts: 1

Join Date: February 7, 2013

Recent Posts

Hi Sagar A Vyas,
can you describe some more about : $request.get("theme-display").path-theme-images
where theme-display is set and about method path-theme-images ?
Amit Doshi
RE: Image is not getting displayed in web content
March 13, 2013 12:32 AM
Answer

Amit Doshi

Rank: Liferay Master

Posts: 547

Join Date: December 29, 2010

Recent Posts

Hi Narendra,

From $request, you will be able to find all this variables value.
So, if you were to dump a $request variable from a template it would look like this:

1
2{ render-url-exclusive=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0 &p_p_state=exclusive&p_p_mode=view& p_p_col_id=column-1&p_p_col_count=1, auth-type=, scheme=http, render-url-normal=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0& p_p_state=normal&p_p_mode=view& p_p_col_id=column-1&p_p_col_count=1, locale=en_US, attributes={ COMPANY_ID=10095, PORTLET_ID=56_INSTANCE_6860, RENDER_PORTLET_COLUMN_POS=0, CURRENT_COMPLETE_URL=http://localhost:8080/web/workshop/home, LAST_PATH={ contextPath=/web, path=/workshop/home }, FRIENDLY_URL=/web/workshop/home, com.liferay.portal.servlet.filters.strip.StripFilterSKIP_FILTER=true, PORTLET_PARALLEL_RENDER=true, RENDER_PORTLET_COLUMN_ID=column-1, LAYOUT_FRIENDLY_URL=/home, CURRENT_URL=/web/workshop/home, RENDER_PORTLET_COLUMN_COUNT=1, org.apache.struts.action.mapping.instance=ActionConfig [path=/journal_content/view, scope=session, type=com.liferay.portlet.journalcontent.action.ViewAction, validate=true,cancellable=false, LIFERAY_SHARED_PAGE_KEYWORDS=[ad], USER_ID=10150, PORTLET_STRUTS_ACTION=/journal_content/view, com.liferay.portal.servlet.filters.gzip.GZipFilterSKIP_FILTER=true }, render-url-pop-up=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0& p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-1 &p_p_col_count=1, render-url-maximized=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0& p_p_state=maximized&p_p_mode=view& p_p_col_id=column-1&p_p_col_count=1, render-url-minimized=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0& p_p_state=minimized&p_p_mode=view& p_p_col_id=column-1&p_p_col_count=1, server-port=8080, portlet-mode=view, secure=false, action=false, theme-display={ secure=false, scope-group-id=10174, portal-url=localhost:8080, plid=10265, path-main=/c, i18n-language-id=, url-portal=localhost:8080, do-as-user-id=, path-context=, path-image=/image, user-id=10150, language-id=en_US, company-id=10095, locale=en_US, time-zone=UTC, path-friendly-url-public=/web, path-theme-images=/sesameworkshop-theme/images, real-user-id=10150, cdn-host=, path-friendly-url-private-group=/group, server-name=localhost, path-friendly-url-private-user=/user, server-port=8080, portlet-display={ title=Journal Content, portlet-name=56, instance-id=6860, resource-pk=10265_LAYOUT_56_INSTANCE_6860, root-portlet-id=56, id=56_INSTANCE_6860 } }, parameters=, container-type=portlet, context-path=/, content-type=text/html, render-url=http://localhost:8080/web/workshop/home ?p_p_id=56_INSTANCE_6860&p_p_lifecycle=0& p_p_state=normal&p_p_mode=view& p_p_col_id=column-1&p_p_col_count=1, remote-user=10150, window-state=normal, server-name=localhost, container-namespace=/, portlet-session={ portlet-attributes=, application-attributes={ com.liferay.portal.kernel.util.ProgressTracker_PERCENT=100, j_username=10150, HTTPS_INITIAL=false, LIFERAY_SHARED_VISITED_GROUP_ID_PREVIOUS=10100, LAST_PATH={ contextPath=/web, path=/workshop/home }, USER_ID=10150, LIFERAY_SHARED_VISITED_GROUP_ID_RECENT=10174, org.apache.struts.action.LOCALE=en_US } }, portlet-namespace=_56_INSTANCE_6860_, portlet-session-id=1D8EA0980982E0C4DD5199B092450A2E } }}}


From the above you will be able to find theme-display and also path-theme-images.

For more info refer this link.

Hope it will be useful.

Thanks & Regards,
Amit Doshi
Sagar A Vyas
RE: Image is not getting displayed in web content
March 13, 2013 1:02 AM
Answer

Sagar A Vyas

Rank: Liferay Master

Posts: 655

Join Date: April 17, 2009

Recent Posts

Narendra Dodiya:
Hi Sagar A Vyas,
can you describe some more about : $request.get("theme-display").path-theme-images
where theme-display is set and about method path-theme-images ?


Narendra,

As precisely described by Amit.

Just wanted to add on top of this is like " $request " it is not actual object we are pointing in Template.

It is just a Map you can say with key and value.

so if you want to access any value[in our example its theme's image path]you should know key[in our example its theme-display].

And if you want to know all keys and value as per Amit said display $request object you will get idea

HTH

Thanks,
Sagar Vyas