PDA

View Full Version : problem with image loading to a dynamic view


nari422
01-27-2009, 05:09 AM
Hi Guys,
I am getting problem with store image for dynamically created view. I have one view called diVw2. For that view i created dynamically one view and add the text and image to that dynamic view .Text added successfully but image not added. I am getting the problem call to undefined method image.


<canvas ondata="canvas.forimages()">
<view id="diVw2" />
<method name="forimages">
sampleimage ="C:\temp\images\fish.jpg" ;
var dynamicView=new lz.view(diVw2,{x:5,y:35,width:515,height:100,bgcol or:'#D74B28',clip:true });
var sampleitem1 =new lz.text(dynamicView,{x:3,text:'Item Name',fgcolor:white});
var sampleitem2 =new lz.image(dynamicView,{x:3,text:'Item Name',fgcolor:white});

ramesh
01-27-2009, 10:48 PM
Hi,

We will show the images on the view node, ( correct?) , I changed your code little bit and its loading the image.

code:

<canvas oninit="forimages()">

<view id="diVw2" width="1000" height="1000">
<simplelayout spacing="10" />
</view>

<method name="forimages">
//sampleimage ="C:\temp\images\fish.jpg" ;
var dynamicView=new lz.view(diVw2,{x:5,y:35,width:515,height:100,bgcol or:'0xcc0000',clip:true });
var sampleitem1 =new lz.text(diVw2,{x:3,text:'Item Name',fgcolor:'0x00cc00'});
var sampleitem2 =new lz.view(diVw2,{x:5,y:35,width:515,height:100,bgcol or:'0x0000cc',clip:true,resource:'http://localhost:8087/lps-4.2.0/laszlo-explorer/assets/header_bg.jpg' });

</method>

</canvas>

Thanks and Regards,
Ramesh G.

rajubitter
01-28-2009, 01:19 PM
You have to make sure that you use a path relative to your webfolder root directory or relative to the LZX file when pointing to a resource.

- Raju

ramesh
01-28-2009, 09:59 PM
Raju,

Thanks to correction!

we will load the image from the local server with relative path(best way). For the remote server/URL, we can use the absolute path. In the above code, i used the absolute path only for demo.

Thanks and Regards,
Ramesh G.