Hi This is dk , i am expert in php/mrsql and Ajax join this for share php works . and post your problem . This is only best for php Developer . Contact me for quality and reliable work. Email me : web.websolution at gmail .com
setp 1: save this code any php file name ex: thumb.php function code : <? function createThumbnail($imageDirectory, $imageName, $thumbDirectory,$thumb_w,$thumb_h) { $size= getimagesize("$imageDirectory/".$imageName); $origHeight = $size[1]; $origWidth = $size[0]; $type=$size[2]; $tsrc="thumb_".$imageName; if(($origHeight)>=($origWidth)) { $thumbHeight =$thumb_h; $thumbWidth = ceil($origWidth *($thumbHeight /$origHeight) ); } if(($origWidth)>=($origHeight)) { $thumbWidth =$thumb_w; $thumbHeight = $origHeight; $thumbHeight = ceil( $origHeight * ($thumbWidth /$origWidth)); } if($type==1) // for gif formate // //resize the image// { $im=imagecreatefromgif("$imageDirectory/".$imageName); $newimage=imagecreatetruecolor($thumbWidth,$thumbHeight); imagecopyresampled($newimage,$im,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagegif($newimage,"$imageDirectory/".$tsrc); chmod("$imageDirectory/$tsrc",0777); } if($type==2) // for jpeg formate // //resize the image// { $im=imagecreatefromjpeg("$imageDirectory/".$imageName); $newimage=imagecreatetruecolor($thumbWidth,$thumbHeight); imagecopyresampled($newimage,$im,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagejpeg($newimage,"$imageDirectory/".$tsrc); chmod("$imageDirectory/$tsrc",0777); } if($type==3) // for png formate // //resize the image// { $im=imagecreatefrompng("$imageDirectory/".$imageName); $newimage=imagecreatetruecolor($thumbWidth,$thumbHeight); imagecopyresampled($newimage,$im,0,0,0,0,$thumbWidth,$thumbHeight,$origWidth,$origHeight); imagepng($newimage,"$imageDirectory/".$tsrc); chmod("$imageDirectory/$tsrc",0777); } ?> step 2: include this function on the in which u want to create thumbnail setp3: createThumbnail('logo', $img, 'logo',50,50);