cancel
Showing results for 
Search instead for 
Did you mean: 

How to map images from My sandbox -> ROOT

preetpalsinghbi
Champ in-the-making
Champ in-the-making
Hi,

I have added a gif image ( abc.gif ) in Web Projects -> ProjectA -> My sandbox -> ROOT folder

I have used xsd and xsl to create a webform. I have captured data using the web form, which gave me an HTML and an xml output. While capturing data in the webform i selected the same image ( abc.gif ) the path of which comes to be /abc.gif.

I am unable to see the gif in the generated html.



I have tried the folowing variables as <variable>/abc.gif in the xsl code.

The code snippet in the xsl is:
*******************************************
<xsl:variable name="header1" > <xsl:value-of select="$alfSmiley Tonguearent_path" /> </xsl:variable>
<xsl:variable name="header" > <xsl:value-of select=".//container/header_image" /> </xsl:variable>
<img src="{$header1}{$header}" alt="abc" />
*******************************************


I have also tried using the $alfSmiley Tonguearent_path variable, output of which comes to be:
dscp1039–admin–preview:/www/avm_webapps/ROOT/abc.gif

I have also tried using the $alf:avm_sandbox_url variable, output of which comes to be:
http://preview.admin.dscp1039.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8180/abc.gif

still i am unable to view the image.

can anyone help?

thanx in advance.
6 REPLIES 6

arielb
Champ in-the-making
Champ in-the-making
i think that what you want is just the request_context_path value which is the url mapping for the webapp (which in the case of ROOT is simply /).

i'd also use the xsl:attribute tag to set the source rather than create variables but that's just a stylistic thing.


<img alt="abc">
  <xsl:attribute name="src">
    <xsl:value-of select="concat($alf:request_context_path, .//container/header_image)"/>
  </xsl:attribute>
</img>

tonizz
Champ in-the-making
Champ in-the-making
And if the only that you want is to obtain the relative path to the image??

I think it could be a better solution. The result would be "container/abc.gif", not having the first '/' and making the path absolute.

Is it possible to get?

Thanks

arielb
Champ in-the-making
Champ in-the-making
it's possible, but you'd need to carefully configure the outputpathpattern for your xsl rendering engine to emit the html into a directory relative to the image.

tonizz
Champ in-the-making
Champ in-the-making
I really need to do it. So how could I do it?

Thanks in advance.

jozh
Champ in-the-making
Champ in-the-making
I'm found the next solution for .ftl template:

<#assign url = alf.parent_path?substring(alf.parent_path?index_of('ROOT')+4) + '/' + alf.form_instance_data_file_name?replace(".xml",".html")>
<a href="${url}">details</a>

anik
Champ in-the-making
Champ in-the-making
we are using web forms for content authoring in Explorer WCM(AVM).
Now when we upload an image through UI File picker, only the image name (eg /Banner1.jpg)
is rendered.

How can we access the entire path of image file that is residing in a webproject avm content

when we see image path in browser Url we get path :
http://localhost:8080/alfresco/d/d/avm/Marketing-Domain--admin/-1%7Cwww%7Cavm_webapps%7CROOT%7CBanne...

when we see image path through image node reference in explorer we get path
avm://Marketing-Domain–admin/-1|www|avm_webapps|ROOT|Banner1.jpg

we tried using these
1) alfSmiley Tonguearent_path
2) alf:request_context_path

The alfSmiley Tonguearent_path gives = Marketing–admin–preview:/www
/avm_webapps/ROOT/Banner1.jpg
and
alf:request_context_path gives= /alfresco

Q1 Can i access reletive path? if Yes then how??
Q2 How can i programatically generate the absolute path (no hard coding or minimum possible)?

Note : I am Using XSL and NOT ftl