I upload to the server using an iframe image. Is there any plug-in for processing them (reducing the size, lowering the quality, etc.) or should I write everything with my hands?

  • And in the label "image" poke? - user6550

1 answer 1

I understand that the reduction is necessary to reduce the amount of data transmitted to the server? I found such a function in Java script ... sorry, I didn’t test it myself, but people write that it works ... and everything seems logical in code ...

function resize(id,xx,yy){ function change_size(elt,img,maxx,maxy){ var d=Math.min(img.height/maxy,img.width/maxx); elt.style.width=Math.floor(img.width/d)+'px'; elt.style.height=Math.floor(img.height/d)+'px'; } var e = document.getElementById(id) , img=new Image() ,on_complete=function(){ change_size(e,img,xx,yy); }; img.src=e.src; if (img.complete) on_complete(); img.oncomplete=on_complete; } 

Accepts image id ( <img/> ), and the desired size, to which to reduce ...

  • This function only changes the LINEAR dimensions of the images ON THE CUSTOMER. That does not affect the "weight" of files, nor the number transmitted over the network. - user6550