prashant purohit
Posts: 0
Joined: Sat Aug 31, 2013 11:00 am

Java Script for Image Re-sizing

Hi,

I have an image element on the page and the image path is returned from the service and mapped to the image element. Images returned from the service are of variable sizes (height and width) and I want to accordingly re-size the image according to a fixed size on screen. Fixed size means Height = 75px and width = width of container.

I have used a java script attached below, which I invoke on a button click and this works perfectly fine to re-size the image. However, I want to invoke this Java script automatically rather than on button click. I tried it on successful service response but it didn't work. Pls suggest.

Code: Select all

Appery('mobileimage_340').attr("style", "width: auto !important; height: auto !important;"); 

         var image = Appery('mobileimage_340'); 
         var parcont = Appery('mobilegrid_60'); 
         var iwidth = image.width(); 
         var iheight = image.height(); 
         var parwidth = parcont.width(); 
         var parheight = 75; 

         var wratio = parwidth / iwidth; 
         var hratio = parheight / iheight; 

         nwidth = aratio * iwidth; 
         nheight = aratio * iheight; 

         Appery('mobileimage_340').attr("style", "width : " + nwidth + "px !important; height : " + nheight + "px !important;");
Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Java Script for Image Re-sizing

Hello,

You could use Page show event.
http://docs.appery.io/documentation/w...

prashant purohit
Posts: 0
Joined: Sat Aug 31, 2013 11:00 am

Java Script for Image Re-sizing

Hi,

I tried that, It doesn't work. Do you want me to share the application and check yourself?

Regds

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Java Script for Image Re-sizing

You could also try to use CSS for image resizing
http://docs.appery.io/documentation/w...

prashant purohit
Posts: 0
Joined: Sat Aug 31, 2013 11:00 am

Java Script for Image Re-sizing

Not sure...how to use the documentation at the link for above query. Request you to pls tell me exactly how to run the js mentioned above

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Java Script for Image Re-sizing

What exactly have you tried and where do you have difficulties?

Return to “Issues”