Quantcast

image shown & not shown

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

image shown & not shown

sommeralex
This post was updated on .
Hi!

I have a component which is loading an image. The wired thing: the same component is not showing the (same) image on another page. so, if i am embedding the component on another page, it is not shown. Even the page-source (html) shows the similar output. the page, where the component is showing the image is the start page. but on another page the component does not show the image. my first guess is that is has something to do with the dispatcher. do i have to tell the dispatcher that he has to dispatch page x?

<div class="roundImage"><p style="background-image: url(img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg)">thumb</p></div>


public class Photo {
        @Parameter(required=true, allowNull=false)
        private User user;
        @Parameter(value="true")
        private Boolean thumb;
        @Parameter(value="50")
        private int width;
        @Parameter(value="50")
        private int height;
               
        @Inject
        @Path("context:img/maxi.png")
        private Asset photoMale;
        @Inject
        @Path("context:img/maxi.png")
        private Asset photoFemale;
        @Inject
        private ConfigurationService config;
       
        public boolean getIsLinked(){
                return user.getPhoto() != null && thumb;
        }
       
        public String getThumbPath(){
                if(user.getPhoto() != null){
                        String path =  config.getUserThumbImageFolder() + user.getPhoto();
                        //path =  config.getContextPath() + path;
                        return path;
                       
                        //File f = new File(path);
                        //if (f.exists()){
                                //return path;
                        //}
                }
                if(user.getGender() == User.Gender.FEMALE){
                        return photoFemale.toClientURL();
                }else{
                        return photoMale.toClientURL();
                }

        }
       
        public String getPath(){
                if(user.getPhoto() != null){
                        //String path =  "/" + config.getUserThumbImageFolder() + user.getPhoto();
                        String path = "/" + config.getUserImageFolder() + user.getPhoto();
                        //path = "/Users/alexandersommer/git/Airwriting/modules/server-application/src/main/webapp" + path; //img/user/thumb/tjab3a3inqhhnr72pk2i.png
                       
                        //IdentityAssetPathConverter pathConverter = new IdentityAssetPathConverter();
                        //String p = pathConverter.convertAssetPath(path);
                        //p = p + "";
                       
                        return path;
                       
                        //File f = new File(path);
                        //if (f.exists()){
                        // return path;
                        //}
               

                }
                if(user.getGender() == User.Gender.FEMALE){
                        return photoFemale.toClientURL();
                }else{
                        return photoMale.toClientURL();
                }
        }
       
        public String getRightPath(){
                if(thumb)
                        return getThumbPath();
                else
                        return getPath();
        }
       
        public int getThumbHeight(){
                return height;
        }
        public int getThumbWidth(){
                return width;
        }
}

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<STYLE TYPE="text/css"> .roundImage p img { opacity: 0; } .roundImage p { float: left; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; -webkit-box-shadow: #000 0 2px 0px; -moz-box-shadow: #000 0 2px 0px; box-shadow: #000 0 2px 0px; } </STYLE>
<script type="text/javascript"> </script>  <div style="margin-right:5px; margin-top:5px">
<t:if test="isLinked">

<div class="roundImage">
<p style="background-image: url(${thumbPath})">
    <img src="${thumbPath}" alt="thumb" />
</p>
</div>

<t:parameter name="else">
<div class="roundImage">
<p style="background-image: url(${thumbPath})">
    <img src="${thumbPath}" alt="thumb" />
</p>
</div>
</t:parameter>
</t:if>
</div>
</t:container>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: image shown & not shown

Thiago H de Paula Figueiredo
On Tue, 03 Apr 2012 17:34:23 -0300, sommeralex  
<[hidden email]> wrote:

> Hi!

Hi!

> I have a component which is loading an image. The wired thing: the same
> component is not showing the (same) image on another page. so, if i am
> embedding the component on another page, it is not shown. Even the
> page-source (html) shows the similar output.
>
> url(img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg

Use absolute URLs instead of relative ones. This isn't related to Tapestry  
at all, by the way.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: image shown & not shown

sommeralex
This post was updated on .
I found the solution, but it still is wired.

WORKING ON MY STARTPAGE

url(img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg)

NOT WORKING ON ANOTHER PAGE

url(img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg)

WORKING ON MY STARTPAGE

url(/img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg)

WORKING ON ANOTHER PAGE

url(/img/user/thumb/r7wqdd1at3l8mvz5fvzf.jpg)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: image shown & not shown

Lance Java
It's not wierd to me, it's expected behaviour ;)
http://www.motive.co.nz/glossary/linking.php
Loading...