welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Wednesday, December 7, 2011

Show image as thmbnail using jquery in

Everyone have to search to display an image in thumbnail..because its necessary to show in thumbnail. Otherwise image was shrink it’s not look good…
When I am surfing I found very easy, simple code to show image in thumbnail….so I share the code with my blog folks………

<script type="text/javascript" src=""></script>
<script type="text/javascript">
function makethumb(src,FixedSize)
{var Width = $(src,this).width();
var Height = $(src,this).height();
var Ratio = Width / Height;
if (Width > FixedSize) {$(src,this).width(FixedSize)}
if (Height > FixedSize) {
var sizedwidth = FixedSize / Ratio;
var sizedheight = FixedSize / Ratio;
if (Height > Width) { if (Height > sizedwidth) {$(src,this).height = FixedSize}
if (sizedwidth > FixedSize) {$(src,this).width($(src,this).width() * Ratio);}
else {$(src,this).height($(src,this).height() * Ratio);}
else {$(src,this).width(FixedSize)}
<img id="a1" class="thumbnail" src="" onload="makethumb(this,100)" />
<img id="a2" class="thumbnail" src="" onload="makethumb(this,100)"/>

i hope this one helpful to all........


Eran Smith said...

Awesome blog man, the things you have mentioned above are really informative and are examples of your awesome writing skills and a good blog.

.net Obfuscator

Post a Comment