echo '<script type="text/javascript"> var max_width = 350; var max_height = 350; function resize_image(img) { if(img.width > img.height){ if(img.width > max_width) { factor = img.width / img.height; height = Math.floor(max_width / factor); img.width = max_width; img.height = height; var newdiv = document.createElement(\'div\'); newdiv.className = \'resize_image\'; newdiv.innerHTML = \'<a href="\' + img.src +\'" onclick="this.target=\\\'_blank\\\'"><img src="\' + img.src +\'" height="\' + height +\'" width="\' + max_width +\'" alt="" title="Kliknij aby powiększyć."></a> <p style="width:\' + max_width +\';">Kliknij na obrazek aby go powiększyć.</p>\'; img.parentNode.insertBefore(newdiv, img); img.parentNode.removeChild(img); } } else{ if(img.height > max_height) { factor = img.height / img.width; width = Math.floor(max_height / factor); img.height = max_height; img.width = width; var newdiv = document.createElement(\'div\'); newdiv.className = \'resize_image\'; newdiv.innerHTML = \'<a href="\' + img.src +\'" onclick="this.target=\\\'_blank\\\'"><img src="\' + img.src +\'" height="\' + max_height +\'" width="\' + width +\'" alt="" title="Kliknij aby powiększyć."></a> <p style="width:\' + max_width +\';">Kliknij na obrazek aby go powiększyć.</p>\'; img.parentNode.insertBefore(newdiv, img); img.parentNode.removeChild(img); } } } </script>';
Na firefoxie i chrome działa, na operze i ie 8 nie