In any website it is necessary to use thumbnail instead of full image to increase loading speed , So prefer thumbnails over the full image . You can create image thumbnail with the simple function.Today i am going to discuss an easy way to create thumbnail image with php . You may need to isntall GD library to do this .

function createthumbnail($src, $dest, $desired_width) 
{
/* read the source image */
$arr_image_details = getimagesize($src);
if ($arr_image_details[2] == 1) {
$imgt = "ImageGIF";
$imgcreatefrom = "ImageCreateFromGIF";
}
if ($arr_image_details[2] == 2) {
$imgt = "ImageJPEG";
$imgcreatefrom = "ImageCreateFromJPEG";
}
if ($arr_image_details[2] == 3) {
$imgt = "ImagePNG";
$imgcreatefrom = "ImageCreateFromPNG";
}
$source_image = $imgcreatefrom($src);
$width = imagesx($source_image);
$height = imagesy($source_image);
/* find the "desired height" of this thumbnail, relative to the desired width  */
$desired_height = floor($height * ($desired_width / $width));
/* create a new, "virtual" image */
$virtual_image = imagecreatetruecolor($desired_width, $desired_height);
/* copy source image at a resized size */
imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
/* create the physical thumbnail image to its destination */
imagejpeg($virtual_image, $dest);
}

now we have function to create image thumbnail, you just need to pass 3 arguments , Image url , thumb destination and desired width .like given below

$src='testimage.jpg';
$thumb='/thumbnail/';
$thumb90='/thumbnail90/';
createthumbnail($src,$thumb,300);
createthumbnail($src,$thumb90,90);
http://codingbin.com/wp-content/uploads/2016/01/placeholder_600x400.svg_.pnghttp://codingbin.com/wp-content/uploads/2016/01/placeholder_600x400.svg_-150x150.pngdevidphpimage,php,thumbnailsIn any website it is necessary to use thumbnail instead of full image to increase loading speed , So prefer thumbnails over the full image . You can create image thumbnail with the simple function.Today i am going to discuss an easy way to create thumbnail image with php...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request