PHP Code

Thumbnail image creation using php code

In this post explains how to create thumbnail image using php code. function make_thumb($img_name,$filename,$new_w,$new_h) { //get image extension. $ext=getExtension($img_name); //creates the new image using the appropriate function from gd library if(!strcmp(“jpg”,$ext) || !strcmp(“JPG”,$ext) || !strcmp(“jpeg”,$ext) || !strcmp(“JPEG”,$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp(“gif”,$ext) || !strcmp(“GIF”,$ext)) $src_img=imagecreatefromgif($img_name); if(!strcmp(“png”,$ext) || !strcmp(“PNG”,$ext)) $src_img=imagecreatefrompng($img_name); //gets the dimmensions of the image $old_x=imagesx($src_img); $old_y=imagesy($src_img); $ratio1=$old_x/$new_w; …

Continue Reading